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
Afficher le fichier Open project: vanilla/vanilla Class Usage Examples

Protected Properties

Свойство Type Description
$currentSections array
$initStaticFired boolean
$sectionItems array

Méthodes publiques

Méthode 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 méthode

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

addGroupIf() public méthode

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 méthode

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

addGroupToGlobalsIf() public méthode

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 méthode

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 méthode

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 méthode

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 méthode

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 méthode

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 méthode

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 méthode

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 méthode

public addSectionItems ( array $section )
$section array

getCurrentSections() public méthode

public getCurrentSections ( ) : array
Résultat array

prepare() public méthode

public prepare ( ) : boolean
Résultat boolean

removeItem() public méthode

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 méthode

public setCurrentSections ( array $currentSections )
$currentSections array

Property Details

$currentSections protected_oe property

protected array $currentSections
Résultat array

$initStaticFired protected_oe static_oe property

protected static bool $initStaticFired
Résultat boolean

$sectionItems protected_oe static_oe property

protected static array $sectionItems
Résultat array