PHP Класс 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.
Наследование: extends NavModule
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$currentSections array
$initStaticFired boolean
$sectionItems array

Открытые методы

Метод Описание
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 )

Описание методов

addGroup() публичный Метод

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

addGroupIf() публичный Метод

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 addGroupToGlobals ( string $text = '', string $key = '', string $cssClass = '', array $sort = [], array $modifiers = [] )
$text string
$key string
$cssClass string
$sort array
$modifiers array

addGroupToGlobalsIf() публичный Метод

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 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 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 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 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 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 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 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 addSectionItems ( array $section )
$section array

getCurrentSections() публичный Метод

public getCurrentSections ( ) : array
Результат array

prepare() публичный Метод

public prepare ( ) : boolean
Результат boolean

removeItem() публичный Метод

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 setCurrentSections ( array $currentSections )
$currentSections array

Описание свойств

$currentSections защищенное свойство

protected array $currentSections
Результат array

$initStaticFired защищенное статическое свойство

protected static bool $initStaticFired
Результат boolean

$sectionItems защищенное статическое свойство

protected static array $sectionItems
Результат array