PHP Class SiteNavModule, vanilla

By default, global items display no matter the section we're in. If a section is not specified, the item is added to the SECTION_DEFAULT. If we are in a section without a custom nav, these items will display. We can force the module to display any section menus by setting the currentSections property. Beware, you'll need to handle the user preference saving if you do this. TODO: Handle the dropdown menu case.
Inheritance: extends NavModule
Exibir arquivo Open project: vanilla/vanilla Class Usage Examples

Protected Properties

Property Type Description
$currentSections array
$initStaticFired boolean
$sectionItems array

Public Methods

Method Description
addGroup ( string $text = '', string $key = '', string $cssClass = '', array $sort = [], array $modifiers = [] )
addGroupIf ( array | boolean | string $isAllowed = true, string $text = '', string $key = '', string $cssClass = '', array $sort = [], array $modifiers = [] )
addGroupToGlobals ( string $text = '', string $key = '', string $cssClass = '', array $sort = [], array $modifiers = [] )
addGroupToGlobalsIf ( $isAllowed, string $text = '', string $key = '', string $cssClass = '', array $sort = [], array $modifiers = [] )
addGroupToSection ( $section, string $text = '', string $key = '', string $cssClass = '', array $sort = [], array $modifiers = [] )
addGroupToSectionIf ( $isAllowed, $section, string $text = '', string $key = '', string $cssClass = '', array $sort = [], array $modifiers = [] )
addLink ( string $text, string $url, string $key = '', string $cssClass = '', array $sort = [], array $modifiers = [], boolean $disabled = false )
addLinkIf ( array | boolean | string $isAllowed, string $text, string $url, string $key = '', string $cssClass = '', array $sort = [], array $modifiers = [], boolean $disabled = false )
addLinkToGlobals ( $text, $url, string $key = '', string $cssClass = '', array $sort = [], array $modifiers = [], boolean $disabled = false )
addLinkToGlobalsIf ( boolean $isAllowed = true, $text, $url, string $key = '', string $cssClass = '', array $sort = [], array $modifiers = [], boolean $disabled = false )
addLinkToSection ( $section, $text, $url, string $key = '', string $cssClass = '', array $sort = [], array $modifiers = [], boolean $disabled = false )
addLinkToSectionIf ( $isAllowed, $section, $text, $url, string $key = '', string $cssClass = '', array $sort = [], array $modifiers = [], boolean $disabled = false )
addSectionItems ( array $section )
getCurrentSections ( ) : array
prepare ( ) : boolean
removeItem ( string $key ) Remove an item from the nested set.
setCurrentSections ( array $currentSections )

Method Details

addGroup() public method

public addGroup ( string $text = '', string $key = '', string $cssClass = '', array $sort = [], array $modifiers = [] )
$text string
$key string
$cssClass string
$sort array
$modifiers array

addGroupIf() public method

public addGroupIf ( array | boolean | string $isAllowed = true, string $text = '', string $key = '', string $cssClass = '', array $sort = [], array $modifiers = [] )
$isAllowed array | boolean | string
$text string
$key string
$cssClass string
$sort array
$modifiers array

addGroupToGlobals() public method

public addGroupToGlobals ( string $text = '', string $key = '', string $cssClass = '', array $sort = [], array $modifiers = [] )
$text string
$key string
$cssClass string
$sort array
$modifiers array

addGroupToGlobalsIf() public method

public addGroupToGlobalsIf ( $isAllowed, string $text = '', string $key = '', string $cssClass = '', array $sort = [], array $modifiers = [] )
$isAllowed
$text string
$key string
$cssClass string
$sort array
$modifiers array

addGroupToSection() public method

public addGroupToSection ( $section, string $text = '', string $key = '', string $cssClass = '', array $sort = [], array $modifiers = [] )
$section
$text string
$key string
$cssClass string
$sort array
$modifiers array

addGroupToSectionIf() public method

public addGroupToSectionIf ( $isAllowed, $section, string $text = '', string $key = '', string $cssClass = '', array $sort = [], array $modifiers = [] )
$isAllowed
$section
$text string
$key string
$cssClass string
$sort array
$modifiers array

addLinkIf() public method

public addLinkIf ( array | boolean | string $isAllowed, string $text, string $url, string $key = '', string $cssClass = '', array $sort = [], array $modifiers = [], boolean $disabled = false )
$isAllowed array | boolean | string
$text string
$url string
$key string
$cssClass string
$sort array
$modifiers array
$disabled boolean

addLinkToGlobals() public method

public addLinkToGlobals ( $text, $url, string $key = '', string $cssClass = '', array $sort = [], array $modifiers = [], boolean $disabled = false )
$text
$url
$key string
$cssClass string
$sort array
$modifiers array
$disabled boolean

addLinkToGlobalsIf() public method

public addLinkToGlobalsIf ( boolean $isAllowed = true, $text, $url, string $key = '', string $cssClass = '', array $sort = [], array $modifiers = [], boolean $disabled = false )
$isAllowed boolean
$text
$url
$key string
$cssClass string
$sort array
$modifiers array
$disabled boolean

addLinkToSection() public method

public addLinkToSection ( $section, $text, $url, string $key = '', string $cssClass = '', array $sort = [], array $modifiers = [], boolean $disabled = false )
$section
$text
$url
$key string
$cssClass string
$sort array
$modifiers array
$disabled boolean

addLinkToSectionIf() public method

public addLinkToSectionIf ( $isAllowed, $section, $text, $url, string $key = '', string $cssClass = '', array $sort = [], array $modifiers = [], boolean $disabled = false )
$isAllowed
$section
$text
$url
$key string
$cssClass string
$sort array
$modifiers array
$disabled boolean

addSectionItems() public method

public addSectionItems ( array $section )
$section array

getCurrentSections() public method

public getCurrentSections ( ) : array
return array

prepare() public method

public prepare ( ) : boolean
return boolean

removeItem() public method

Remove an item from the nested set.
public removeItem ( string $key )
$key string The key of the item to remove, separated by dots.

setCurrentSections() public method

public setCurrentSections ( array $currentSections )
$currentSections array

Property Details

$currentSections protected_oe property

protected array $currentSections
return array

$initStaticFired protected_oe static_oe property

protected static bool $initStaticFired
return boolean

$sectionItems protected_oe static_oe property

protected static array $sectionItems
return array