API Documentation

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

$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
string

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
static

forRoute()

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
static

fromArray()

public static fromArray(string $name, array<string|int, NavItem$items) : static
Parameters
$name : string
$items : array<string|int, NavItem>
Return values
static

fromRoute()

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
static

getDestination()

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
string

getGroup()

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|null

getLabel()

Get the label of the navigation item.

public getLabel() : string
Return values
string

getPriority()

Get the priority to determine the order of the navigation item.

public getPriority() : int
Return values
int

isCurrent()

Check if the NavItem instance is the current page.

public isCurrent() : bool
Return values
bool

getRouteGroup()

protected static getRouteGroup(Route $route) : string|null
Parameters
$route : Route
Return values
string|null

normalizeGroupKey()

protected static normalizeGroupKey(string|null $group) : string|null
Parameters
$group : string|null
Return values
string|null

searchForDropdownPriorityInNavigationConfig()

private searchForDropdownPriorityInNavigationConfig(string $groupKey) : int|null
Parameters
$groupKey : string
Return values
int|null

        
On this page

Search results