Property | Type | Description | |
---|---|---|---|
$activeCssClass | The css class to add to active items and groups. | ||
$dividerCssClassPrefix | CSS prefix for a divider item. | ||
$headerCssClassPrefix | CSS prefix for a header item. | ||
$items | List of items to sort. | ||
$linkCssClassPrefix | CSS prefix for a link item. | ||
$useCssPrefix | Whether to use CSS prefixes on the generated CSS classes for the items. |
Property | Type | Description | |
---|---|---|---|
$allowedItemModifiers | The item modifiers allowed to be passed in the modifiers array. |
Method | Description | |
---|---|---|
addDivider ( string $key = '', string $cssClass = '', array | integer $sort = [] ) : object | Add a divider to the items array. | |
addDividerIf ( boolean | string | array $isAllowed = true, string $key = '', string $cssClass = '', array | integer $sort = [] ) : object | Add a divider to the items array if it satisfies the $isAllowed condition. | |
addGroup ( string $text = '', string $key = '', string $cssClass = '', array | integer $sort = [], array $modifiers = [] ) : SortableModule | Add a group to the items array. | |
addGroupIf ( boolean | string | array $isAllowed = true, string $text = '', string $key = '', string $cssClass = '', array | integer $sort = [], array $modifiers = [] ) : object | Add a group to the items array if it satisfies the $isAllowed condition. | |
addItemModifiers ( array &$item, array $modifiers ) | Adds the attributes in the modifiers array to the item. | |
addLink ( string $text, string $url, string $key = '', string $cssClass = '', array | integer $sort = [], array $modifiers = [], boolean $disabled = false ) | Add a link to the items array. | |
addLinkIf ( boolean | string | array $isAllowed = true, string $text, string $url, string $key = '', string $cssClass = '', array | integer $sort = [], array $modifiers = [], boolean $disabled = false ) : object | Add a link to the items array if it satisfies the $isAllowed condition. | |
getHighlightRoute ( ) : string | ||
prepare ( ) : boolean | Prepares the items array for output by sorting and optionally flattening. | |
removeItem ( string $key ) | Remove an item from the nested set. | |
setForceDivider ( boolean $forceDivider ) | ||
setHighlightRoute ( string $highlightRoute ) |
Method | Description | |
---|---|---|
addItem ( string $type, array $item ) | Add an item to the items array. | |
buildCssClass ( string $prefix, array $item ) : string | Builds a CSS class for an item, based on the 'key' property of the item. | |
flattenArray ( array $items ) : array | Creates a flattened array of menu items. | |
isActive ( array $item ) : boolean | Checks whether the current request url matches an item's link url. | |
isAllowed ( boolean | string | array $isAllowed ) : boolean | Checks whether an item can be added to the items list by returning it if it is already a boolean, or checking the permission if it is a string or array. | |
prepareData ( array &$items ) | Performs post-sort operations to the items array. | |
sortItems ( array &$items ) | Recursive function to sort the items in a given array. | |
sortItemsOrder ( array $item, array $items, integer $depth ) : number | Get the sort order of an item in the items array. | |
touchKey ( array &$item ) | Generate a key for an item if one does not exist, and add the property to the item. |
public addDivider ( string $key = '', string $cssClass = '', array | integer $sort = [] ) : object | ||
$key | string | The item's key (for sorting and CSS targeting). |
$cssClass | string | The divider's CSS class. |
$sort | array | integer | Either a numeric sort position or and array in the style: array('before|after', 'key'). |
return | object | $this The calling object. |
public addDividerIf ( boolean | string | array $isAllowed = true, string $key = '', string $cssClass = '', array | integer $sort = [] ) : object | ||
$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. |
$key | string | The item's key (for sorting and CSS targeting). |
$cssClass | string | The divider's CSS class. |
$sort | array | integer | Either a numeric sort position or and array in the style: array('before|after', 'key'). |
return | object | $this The calling object. |
public addGroup ( string $text = '', string $key = '', string $cssClass = '', array | integer $sort = [], array $modifiers = [] ) : SortableModule | ||
$text | string | The display text for the group header. |
$key | string | The item's key (for sorting and CSS targeting). |
$cssClass | string | The group header's CSS class. |
$sort | array | integer | Either a numeric sort position or and array in the style: array('before|after', 'key'). |
$modifiers | array | List of attribute => value, where the attribute is in $this->allowedItemModifiers. - **popinRel**: string - Endpoint for a popin. - **badge**: string - Info to put into a badge, usually a number. - **icon**: string - Name of the icon for the item, excluding the 'icon-' prefix. |
return | SortableModule | $this The calling object. |
public addGroupIf ( boolean | string | array $isAllowed = true, string $text = '', string $key = '', string $cssClass = '', array | integer $sort = [], array $modifiers = [] ) : object | ||
$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. |
$text | string | The display text for the group header. |
$key | string | The item's key (for sorting and CSS targeting). |
$cssClass | string | The group header's CSS class. |
$sort | array | integer | Either a numeric sort position or and array in the style: array('before|after', 'key'). |
$modifiers | array | List of attribute => value, where the attribute is in $this->allowedItemModifiers. - **popinRel**: string - Endpoint for a popin. - **badge**: string - Info to put into a badge, usually a number. - **icon**: string - Name of the icon for the item, excluding the 'icon-' prefix. |
return | object | $this The calling object. |
public addItemModifiers ( array &$item, array $modifiers ) | ||
$item | array | The item to modify. |
$modifiers | array | The modifiers to add to the item. |
public addLink ( string $text, string $url, string $key = '', string $cssClass = '', array | integer $sort = [], array $modifiers = [], boolean $disabled = false ) | ||
$text | string | The display text for the link. |
$url | string | The destination url for the link. |
$key | string | The item's key (for sorting and CSS targeting). |
$cssClass | string | The link's CSS class. |
$sort | array | integer | Either a numeric sort position or and array in the style: array('before|after', 'key'). |
$modifiers | array | List of attribute => value, where the attribute is in $this->allowedItemModifiers. - **popinRel**: string - Endpoint for a popin. - **badge**: string - Info to put into a badge, usually a number. - **icon**: string - Name of the icon for the item, excluding the 'icon-' prefix. |
$disabled | boolean | Whether to disable the link. |
public addLinkIf ( boolean | string | array $isAllowed = true, string $text, string $url, string $key = '', string $cssClass = '', array | integer $sort = [], array $modifiers = [], boolean $disabled = false ) : object | ||
$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. |
$text | string | The display text for the link. |
$url | string | The destination url for the link. |
$key | string | The item's key (for sorting and CSS targeting). |
$cssClass | string | The link's CSS class. |
$sort | array | integer | Either a numeric sort position or and array in the style: array('before|after', 'key'). |
$modifiers | array | List of attribute => value, where the attribute is in $this->allowedItemModifiers. - **popinRel**: string - Endpoint for a popin. - **badge**: string - Info to put into a badge, usually a number. - **icon**: string - Name of the icon for the item, excluding the 'icon-' prefix. |
$disabled | boolean | Whether to disable the link. |
return | object | $this The calling object. |
protected flattenArray ( array $items ) : array | ||
$items | array | The item list to flatten. |
return | array | The flattened items list. |
protected isAllowed ( boolean | string | array $isAllowed ) : boolean | ||
$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. |
return | boolean | Whether the item has permission to be added to the items list. |
protected prepareData ( array &$items ) | ||
$items | array | The item list to parse. |
public removeItem ( string $key ) | ||
$key | string | The key of the item to remove, separated by dots. |
public setForceDivider ( boolean $forceDivider ) | ||
$forceDivider | boolean | Whether to separate groups with a element. Only supported for flattened lists. |
public setHighlightRoute ( string $highlightRoute ) | ||
$highlightRoute | string |
public $activeCssClass |
protected $allowedItemModifiers |
public $dividerCssClassPrefix |