DropdownNavItem
extends NavItem
in package
A navigation item that contains other navigation items.
Unlike a regular navigation items, a dropdown item does not have a route or URL destination.
Table of Contents
Properties
- $destination : string
- $group : string|null
- $items : array<string|int, NavItem>
- $label : string
- $priority : int
Methods
- __construct() : mixed
- Create a new navigation menu item.
- __toString() : string
- Resolve a link to the navigation item.
- forLink() : static
- Create a new navigation menu item leading to an external URI.
- forRoute() : static
- Create a new navigation menu item leading to a Route model.
- fromArray() : static
- fromRoute() : static
- Create a new navigation menu item from a route.
- getDestination() : string
- Get the destination link of the navigation item.
- getGroup() : string|null
- Get the group identifier of the navigation item, if any.
- getItems() : Collection<string|int, NavItem>
- getLabel() : string
- Get the label of the navigation item.
- getPriority() : int
- Get the priority to determine the order of the navigation item.
- isCurrent() : bool
- Check if the NavItem instance is the current page.
- getRouteGroup() : string|null
- normalizeGroupKey() : string|null
- searchForDropdownPriorityInNavigationConfig() : int|null
Properties
$destination read-only
public
string
$destination
$group read-only
public
string|null
$group
$items
public
array<string|int, NavItem>
$items
$label read-only
public
string
$label
$priority read-only
public
int
$priority
Methods
__construct()
Create a new navigation menu item.
public
__construct(string $label, array<string|int, NavItem> $items[, int|null $priority = null ]) : mixed
Parameters
- $label : string
- $items : array<string|int, NavItem>
- $priority : int|null = null
__toString()
Resolve a link to the navigation item.
public
__toString() : string
Return values
stringforLink()
Create a new navigation menu item leading to an external URI.
public
static forLink(string $href, string $label[, int $priority = 500 ]) : static
Parameters
- $href : string
- $label : string
- $priority : int = 500
Return values
staticforRoute()
Create a new navigation menu item leading to a Route model.
public
static forRoute(Route|string $route[, string|null $label = null ][, int|null $priority = null ][, string|null $group = null ]) : static
Parameters
- $route : Route|string
- $label : string|null = null
-
Leave blank to use the label of the route's corresponding page.
- $priority : int|null = null
-
Leave blank to use the priority of the route's corresponding page.
- $group : string|null = null
-
Leave blank to use the group of the route's corresponding page.
Return values
staticfromArray()
public
static fromArray(string $name, array<string|int, NavItem> $items) : static
Parameters
- $name : string
- $items : array<string|int, NavItem>
Return values
staticfromRoute()
Create a new navigation menu item from a route.
public
static fromRoute(Route $route[, string|null $label = null ][, int|null $priority = null ][, string|null $group = null ]) : static
Parameters
- $route : Route
- $label : string|null = null
- $priority : int|null = null
- $group : string|null = null
Return values
staticgetDestination()
Get the destination link of the navigation item.
public
getDestination() : string
If the navigation item is an external link, this will return the link as is, if it's for a route, a resolved relative link will be returned.
Return values
stringgetGroup()
Get the group identifier of the navigation item, if any.
public
getGroup() : string|null
For sidebars this is the category key, for navigation menus this is the dropdown key.
Return values
string|nullgetItems()
public
getItems() : Collection<string|int, NavItem>
Return values
Collection<string|int, NavItem>getLabel()
Get the label of the navigation item.
public
getLabel() : string
Return values
stringgetPriority()
Get the priority to determine the order of the navigation item.
public
getPriority() : int
Return values
intisCurrent()
Check if the NavItem instance is the current page.
public
isCurrent() : bool
Return values
boolgetRouteGroup()
protected
static getRouteGroup(Route $route) : string|null
Parameters
- $route : Route
Return values
string|nullnormalizeGroupKey()
protected
static normalizeGroupKey(string|null $group) : string|null
Parameters
- $group : string|null
Return values
string|nullsearchForDropdownPriorityInNavigationConfig()
private
searchForDropdownPriorityInNavigationConfig(string $groupKey) : int|null
Parameters
- $groupKey : string