Navigation
in package
Repesents a single navigation menu.
Tags
Table of Contents
Properties
- $_footerNav : array<string|int, mixed>
- $_panel : bool
- $_topNavbar : array<string|int, mixed>
Methods
- __construct() : mixed
- add() : void
- Add a simple item to this navigation instance.
- addDropdown() : void
- Add a dropdown menu to the navigation.
- addItemToDropdown() : void
- Add an item to a menu dropdown.
- returnNav() : array<string|int, mixed>
- Return top navigation.
Properties
$_footerNav
private
array<string|int, mixed>
$_footerNav
= []
Footer navigation items.
$_panel
private
bool
$_panel
Whether this nav bar is for StaffCP.
$_topNavbar
private
array<string|int, mixed>
$_topNavbar
= []
Top navigation items.
Methods
__construct()
public
__construct([bool $panel = false ]) : mixed
Parameters
- $panel : bool = false
add()
Add a simple item to this navigation instance.
public
add(string $name, string $title, string $link[, string $location = 'top' ][, string|null $target = null ][, float $order = 10 ][, string|null $icon = '' ]) : void
Parameters
- $name : string
-
Unique name for the navbar item, if the page name equals this the item will display as active.
- $title : string
-
Item title.
- $link : string
-
HTML href attribute, can be link built with URL class or hyperlink.
- $location : string = 'top'
-
Location to add item to, either 'top' or 'footer' (defaults to 'top').
- $target : string|null = null
-
HTML target attribute (eg '_blank').
- $order : float = 10
-
Nav item order (default 10).
- $icon : string|null = ''
-
Icon to prepend to nav item.
addDropdown()
Add a dropdown menu to the navigation.
public
addDropdown(string $name, string $title[, string $location = 'top' ][, int $order = 10 ][, string $icon = '' ]) : void
Parameters
- $name : string
-
Unique name for the dropdown
- $title : string
-
Dropdown title
- $location : string = 'top'
-
Location to add item to, either 'top' or 'footer' (defaults to 'top').
- $order : int = 10
-
Nav item order (default 10).
- $icon : string = ''
-
Icon to prepend to nav item.
addItemToDropdown()
Add an item to a menu dropdown.
public
addItemToDropdown(string $dropdown, string $name, string $title, string $link[, string $location = 'top' ][, string|null $target = null ][, string $icon = '' ][, int $order = 10 ]) : void
Parameters
- $dropdown : string
-
Name of dropdown to add item to.
- $name : string
-
Unique name for the item, if the page name equals this the item will display as active.
- $title : string
-
Item title.
- $link : string
-
HTML href attribute, can be link built with URL class or hyperlink.
- $location : string = 'top'
-
Location to add item to, either 'top' or 'footer' (defaults to 'top').
- $target : string|null = null
-
HTML target attribute (eg '_blank')
- $icon : string = ''
-
Icon to prepend to nav item
- $order : int = 10
-
Nav item order
returnNav()
Return top navigation.
public
returnNav([string $location = 'top' ]) : array<string|int, mixed>
Parameters
- $location : string = 'top'
-
Either 'top' or 'footer' (defaults to 'top').
Return values
array<string|int, mixed> —Array to pass to template