PHP Class NavModule, vanilla

The module contains an array of items. Each item can be one of the following types: link, group, or divider. When adding an item you provide an array of with the following keys.
Inheritance: extends Gdn_Module
Show file Open project: vanilla/vanilla Class Usage Examples

Public Properties

Property Type Description
$cssClass A potential CSS class of the nav wrapper container.

Public Methods

Method Description
__construct ( string $cssClass = '', boolean $useCssPrefix = true )
addDropdown ( DropdownModule $dropdown, string $key = '', string $cssClass = '', array | integer $sort = [] ) : NavModule Add a dropdown menu to the items array.
addDropdownIf ( boolean | string | array $isAllowed = true, DropdownModule $dropdown, string $key = '', string $cssClass = '', array | integer $sort = [] ) : NavModule Add a dropdown to the items array if it satisfies the $isAllowed condition.
toString ( )

Method Details

__construct() public method

public __construct ( string $cssClass = '', boolean $useCssPrefix = true )
$cssClass string A potential CSS class of the dropdown menu wrapper container.
$useCssPrefix boolean Whether to use CSS prefixes on the nav items.

addDropdown() public method

Add a dropdown menu to the items array.
public addDropdown ( DropdownModule $dropdown, string $key = '', string $cssClass = '', array | integer $sort = [] ) : NavModule
$dropdown DropdownModule The dropdown menu to add.
$key string The item's key (for sorting and CSS targeting).
$cssClass string The dropdown wrapper's CSS class.
$sort array | integer Either a numeric sort position or and array in the style: array('before|after', 'key').
return NavModule $this The calling object.

addDropdownIf() public method

Add a dropdown to the items array if it satisfies the $isAllowed condition.
public addDropdownIf ( boolean | string | array $isAllowed = true, DropdownModule $dropdown, string $key = '', string $cssClass = '', array | integer $sort = [] ) : NavModule
$isAllowed boolean | string | array Either a boolean to indicate whether to actually add the item or a permission string or array of permission strings (full match) to check.
$dropdown DropdownModule The dropdown menu to add.
$key string The item's key (for sorting and CSS targeting).
$cssClass string The dropdown wrapper's CSS class.
$sort array | integer Either a numeric sort position or and array in the style: array('before|after', 'key').
return NavModule $this The calling object.

toString() public method

public toString ( )

Property Details

$cssClass public property

A potential CSS class of the nav wrapper container.
public $cssClass