NavbarNavigationPageTree
extends SigmaPageTree
in package
SigmaPageTree
Tags
Table of Contents
Constants
- StyleNameActive : mixed = "active"
- StyleNameActiveStarter : mixed = 'starter_active'
- StyleNameMenuNode : mixed = 'menu_node'
- StyleNameNormal : mixed = "inactive"
- StyleNameNormalStarter : mixed = 'starter_normal'
- ACTIVE_SUFFIX : string = '_active'
- Suffix of the template block that defines the block for active nodes
- BLOCK_PREFIX : string = 'level'
- Prefix of the template block that defines a navigation level
- HAS_SUBMENU_SUFFIX : string = '_has_sub_menu'
- Suffix of the template block to be used as alternative to {@see NavbarNavigationPageTree::BLOCK_PREFIX} for pages having children
- NO_LIMIT : int = -1
- Indicates that all levels shall get parsed.
- PARSE_BRANCH : string = 'branch'
- Indicates that only nodes of the active branch shall get parsed.
- PARSE_FULL : string = 'full'
- Indicates that all nodes of a level shall get parsed.
- SUBMENU_SUFFIX : string = '_sub_menu'
- Suffix of the template block that defines the block to include the sub-navigation of a page
- TEMPLATE_TYPE_LEVEL : int = 1
- Identifier for the 'level' template block
- TEMPLATE_TYPE_LEVEL_ACTIVE : int = 5
- Identifier for the 'level_active' template block
- TEMPLATE_TYPE_LEVEL_HAS_SUBMENU : int = 2
- Identifier for the 'has_sub_menu' template block
- TEMPLATE_TYPE_LEVEL_HAS_SUBMENU_ACTIVE : int = 4
- Identifier for the 'has_sub_menu_active' template block
- TEMPLATE_TYPE_SUBMENU : int = 3
- Identifier for the 'sub_menu' template block
- TEMPLATE_TYPES : array<string|int, mixed> = [self::TEMPLATE_TYPE_LEVEL => self::BLOCK_PREFI...
- List of block templates used by this navigation.
Properties
- $bytes : mixed
- $considerLogin : mixed
- $considerSeoEnabledOnly : bool
- Consider seo enabled pages alone
- $currentPage : mixed
- $currentPageOnRootNode : mixed
- $currentPagePath : mixed
- $depth : mixed
- $em : mixed
- $lang : mixed
- $levelConfig : array<string|int, mixed>
- Hold the configuration which levels shall get parsed. Whereas the keys represent the level to parse and the value if the full level or just the nodes of the active branch shall get parsed.
- $license : mixed
- $menuIndex : mixed
- $navigationIds : mixed
- $nodeRepo : mixed
- $pageIdsAtCurrentPath : mixed
- $pageRepo : mixed
- $rootNode : mixed
- $skipInactive : mixed
- $skipInvisible : mixed
- $startLevel : mixed
- $startPath : mixed
- $subNavTag : mixed
- $template : Sigma
- $templates : array<string|int, mixed>
- Hold the template blocks to be used for parsing each level.
- $version : mixed
- $virtualLanguageDirectory : mixed
- $virtualPagesAdded : mixed
- $cache : mixed
- $previousLevel : mixed
Methods
- __construct() : mixed
- isPagePathActive() : bool
- Tells wheter $pathToPage is in the active branch
- postRenderLevel() : mixed
- preRenderLevel() : mixed
- render() : string
- returns the string representation of the tree.
- setTemplate() : mixed
- setVirtualLanguageDirectory() : mixed
- getFirstLevel() : mixed
- getFullNavigation() : bool
- getLastLevel() : mixed
- getLevelFromSelector() : int
- Resolves a selector keyword or number into an actual level integer.
- getMetaImageOfPage() : string
- Get the path of the set meta image of $page. If $page does not have a meta image set, then the path to the default meta image set by the basic configuration is returned instead.
- getTemplate() : string
- Retrieves a specific template for the given navigation level and type.
- init() : mixed
- Initialization is done in {@see NavbarNavigationPageTree::realPreRender()}
- initFallbackLevels() : void
- Initializes default fallback level configuration if no configuration has been set.
- initLevel() : void
- Initializes the template configuration for a given navigation level.
- injectParsedSubnavigations() : void
- injectSubnavigation() : void
- This method fills out the placeholder {SUB_MENU} of the previous parsed page.
- internalRender() : mixed
- isSubMenuParsingSetup() : bool
- Determines whether submenu parsing is set up for a given level.
- loadBulkLevelSelectors() : void
- Checks for [[LEVELS_FULL]], [[levels_full]] or [[LEVELS_BRANCH]] placeholders. If any of those are present, enable parsing of all levels in either full (if [[LEVELS_FULL]] or [[levels_full]] is present) or branch (if [[LEVELS_BRANCH]] is present) mode.
- loadLevelsFromBlocks() : void
- Sets levels to parse based on the presence of template blocks.
- loadSpecificLevelSelectors() : void
- Sets the levels to parse based on matched placeholders of the format: `LEVELS_{start}_{end}[_TYPE]` Where: - start/end can be numeric, `PREVIOUS`, `CURRENT`, `NEXT`, or `NOLIMIT` - TYPE can be `FULL` (default) or `BRANCH`
- postRender() : mixed
- postRenderElement() : mixed
- preRender() : mixed
- Sets the version based on [[V<version>]] placeholders
- preRenderElement() : mixed
- realPreRender() : mixed
- renderElement() : string
- Override this to do your representation of the tree.
- renderFooter() : mixed
- renderHeader() : mixed
Constants
StyleNameActive
public
mixed
StyleNameActive
= "active"
StyleNameActiveStarter
public
mixed
StyleNameActiveStarter
= 'starter_active'
StyleNameMenuNode
public
mixed
StyleNameMenuNode
= 'menu_node'
StyleNameNormal
public
mixed
StyleNameNormal
= "inactive"
StyleNameNormalStarter
public
mixed
StyleNameNormalStarter
= 'starter_normal'
ACTIVE_SUFFIX
Suffix of the template block that defines the block for active nodes
protected
string
ACTIVE_SUFFIX
= '_active'
BLOCK_PREFIX
Prefix of the template block that defines a navigation level
protected
string
BLOCK_PREFIX
= 'level'
HAS_SUBMENU_SUFFIX
Suffix of the template block to be used as alternative to {@see NavbarNavigationPageTree::BLOCK_PREFIX} for pages having children
protected
string
HAS_SUBMENU_SUFFIX
= '_has_sub_menu'
NO_LIMIT
Indicates that all levels shall get parsed.
protected
int
NO_LIMIT
= -1
PARSE_BRANCH
Indicates that only nodes of the active branch shall get parsed.
protected
string
PARSE_BRANCH
= 'branch'
PARSE_FULL
Indicates that all nodes of a level shall get parsed.
protected
string
PARSE_FULL
= 'full'
SUBMENU_SUFFIX
Suffix of the template block that defines the block to include the sub-navigation of a page
protected
string
SUBMENU_SUFFIX
= '_sub_menu'
TEMPLATE_TYPE_LEVEL
Identifier for the 'level' template block
protected
int
TEMPLATE_TYPE_LEVEL
= 1
TEMPLATE_TYPE_LEVEL_ACTIVE
Identifier for the 'level_active' template block
protected
int
TEMPLATE_TYPE_LEVEL_ACTIVE
= 5
TEMPLATE_TYPE_LEVEL_HAS_SUBMENU
Identifier for the 'has_sub_menu' template block
protected
int
TEMPLATE_TYPE_LEVEL_HAS_SUBMENU
= 2
TEMPLATE_TYPE_LEVEL_HAS_SUBMENU_ACTIVE
Identifier for the 'has_sub_menu_active' template block
protected
int
TEMPLATE_TYPE_LEVEL_HAS_SUBMENU_ACTIVE
= 4
TEMPLATE_TYPE_SUBMENU
Identifier for the 'sub_menu' template block
protected
int
TEMPLATE_TYPE_SUBMENU
= 3
TEMPLATE_TYPES
List of block templates used by this navigation.
protected
array<string|int, mixed>
TEMPLATE_TYPES
= [self::TEMPLATE_TYPE_LEVEL => self::BLOCK_PREFIX, self::TEMPLATE_TYPE_LEVEL_ACTIVE => self::BLOCK_PREFIX . self::ACTIVE_SUFFIX, self::TEMPLATE_TYPE_LEVEL_HAS_SUBMENU => self::HAS_SUBMENU_SUFFIX, self::TEMPLATE_TYPE_LEVEL_HAS_SUBMENU_ACTIVE => self::HAS_SUBMENU_SUFFIX . self::ACTIVE_SUFFIX, self::TEMPLATE_TYPE_SUBMENU => self::SUBMENU_SUFFIX]
Properties
$bytes
protected
mixed
$bytes
$considerLogin
protected
mixed
$considerLogin
= true
$considerSeoEnabledOnly
Consider seo enabled pages alone
protected
bool
$considerSeoEnabledOnly
$currentPage
protected
mixed
$currentPage
= null
$currentPageOnRootNode
protected
mixed
$currentPageOnRootNode
= false
$currentPagePath
protected
mixed
$currentPagePath
= null
$depth
protected
mixed
$depth
= null
$em
protected
mixed
$em
= null
$lang
protected
mixed
$lang
= null
$levelConfig
Hold the configuration which levels shall get parsed. Whereas the keys represent the level to parse and the value if the full level or just the nodes of the active branch shall get parsed.
protected
array<string|int, mixed>
$levelConfig
= []
If only the level static::NO_LIMIT is set, then all levels are parsed. If along with static::NO_LIMIT any other levels are set, then only the remaining levels from the highest defined level are parsed - along with any other explicitly defined level.
$license
protected
mixed
$license
= null
$menuIndex
protected
mixed
$menuIndex
= 0
$navigationIds
protected
mixed
$navigationIds
= array()
$nodeRepo
protected
mixed
$nodeRepo
$pageIdsAtCurrentPath
protected
mixed
$pageIdsAtCurrentPath
= array()
$pageRepo
protected
mixed
$pageRepo
= null
$rootNode
protected
mixed
$rootNode
= null
$skipInactive
protected
mixed
$skipInactive
$skipInvisible
protected
mixed
$skipInvisible
= true
$startLevel
protected
mixed
$startLevel
$startPath
protected
mixed
$startPath
$subNavTag
protected
mixed
$subNavTag
= array(1 => '<ul id="menubuilder%s" class="menu">{SUB_MENU}</ul>', 2 => '<ul class="level_%s menu">{SUB_MENU}</ul>')
$template
protected
Sigma
$template
= null
$templates
Hold the template blocks to be used for parsing each level.
protected
array<string|int, mixed>
$templates
= []
Get's initialized by NavbarNavigationPageTree::initLevel().
$version
protected
mixed
$version
= 1
$virtualLanguageDirectory
protected
mixed
$virtualLanguageDirectory
$virtualPagesAdded
protected
static mixed
$virtualPagesAdded
= false
$cache
private
mixed
$cache
= array()
$previousLevel
private
mixed
$previousLevel
= 1
Methods
__construct()
public
__construct(mixed $entityManager, License $license[, int $maxDepth = 0 ][, Node $rootNode = null ][, int $lang = null ][, Page $currentPage = null ][, bool $skipInvisible = true ][, bool $considerLogin = true ][, mixed $skipInactive = true ][, bool $considerSeoEnabledOnly = false ]) : mixed
Parameters
- $entityManager : mixed
-
the doctrine em
- $license : License
-
License used to check if a module is allowed in frontend
- $maxDepth : int = 0
-
maximum depth to fetch, 0 means everything
- $rootNode : Node = null
-
node to use as root
- $lang : int = null
-
the language
- $currentPage : Page = null
-
if set, renderElement() will receive a correctly set $current flag.
- $skipInvisible : bool = true
-
value to skip invisible pages
- $considerLogin : bool = true
-
value to consider whether the user is logged in or not
- $skipInactive : mixed = true
- $considerSeoEnabledOnly : bool = false
-
Consider seo enabled pages alone
isPagePathActive()
Tells wheter $pathToPage is in the active branch
public
isPagePathActive(string $pathToPage) : bool
Parameters
- $pathToPage : string
Return values
bool —True if active, false otherwise
postRenderLevel()
public
postRenderLevel(mixed $level, mixed $lang, mixed $parentNode) : mixed
Parameters
- $level : mixed
- $lang : mixed
- $parentNode : mixed
preRenderLevel()
public
preRenderLevel(mixed $level, mixed $lang, mixed $parentNode) : mixed
Parameters
- $level : mixed
- $lang : mixed
- $parentNode : mixed
render()
returns the string representation of the tree.
public
render() : string
Return values
stringsetTemplate()
public
setTemplate(mixed $template) : mixed
Parameters
- $template : mixed
-
the PEAR Sigma template.
setVirtualLanguageDirectory()
public
setVirtualLanguageDirectory(mixed $dir) : mixed
Parameters
- $dir : mixed
getFirstLevel()
protected
getFirstLevel() : mixed
getFullNavigation()
protected
getFullNavigation(int $level) : bool
Parameters
- $level : int
Return values
boolgetLastLevel()
protected
getLastLevel() : mixed
getLevelFromSelector()
Resolves a selector keyword or number into an actual level integer.
protected
getLevelFromSelector(string $selector) : int
Special values:
PREVIOUS: one level above the current, minimum 1CURRENT: the current levelNEXT: one level below the currentNOLIMIT: no-limit -> all remaining levels- numeric: cast directly to integer
Parameters
- $selector : string
-
The level selector string.
Return values
int —The resolved level number.
getMetaImageOfPage()
Get the path of the set meta image of $page. If $page does not have a meta image set, then the path to the default meta image set by the basic configuration is returned instead.
protected
getMetaImageOfPage(Page $page) : string
Parameters
- $page : Page
Return values
string —Path to meta image
getTemplate()
Retrieves a specific template for the given navigation level and type.
protected
getTemplate(int $level[, int $type = self::TEMPLATE_TYPE_LEVEL ]) : string
Validates the template type and returns the corresponding template if available. Returns an empty string if the template is not set for the given level and type.
Parameters
- $level : int
-
The navigation depth level.
- $type : int = self::TEMPLATE_TYPE_LEVEL
-
The template type (defaults to TEMPLATE_TYPE_LEVEL).
Tags
Return values
string —The template string or an empty string if not found.
init()
Initialization is done in {@see NavbarNavigationPageTree::realPreRender()}
protected
init() : mixed
initFallbackLevels()
Initializes default fallback level configuration if no configuration has been set.
protected
initFallbackLevels() : void
Defaults to:
- static::NO_LIMIT => static::PARSE_FULL
initLevel()
Initializes the template configuration for a given navigation level.
protected
initLevel(int $level) : void
Checks whether the template for the specified level has already been initialized. If not, it attempts to locate and assign the block and submenu templates for that level. Falls back to a legacy submenu tag if no submenu block exists.
Parameters
- $level : int
-
The navigation depth level to initialize templates for.
injectParsedSubnavigations()
protected
injectParsedSubnavigations([int $currentLevel = 0 ]) : void
Parameters
- $currentLevel : int = 0
Tags
injectSubnavigation()
This method fills out the placeholder {SUB_MENU} of the previous parsed page.
protected
injectSubnavigation(mixed $level) : void
Parameters
- $level : mixed
internalRender()
protected
internalRender(mixed $node[, type $dontDescend = false ]) : mixed
Parameters
- $node : mixed
- $dontDescend : type = false
Tags
isSubMenuParsingSetup()
Determines whether submenu parsing is set up for a given level.
protected
isSubMenuParsingSetup(int $level) : bool
Checks the parent level's submenu and children templates to see if
submenu parsing should be performed. Returns true if either a
submenu template is defined or the children template contains a
{SUB_MENU} placeholder.
Parameters
- $level : int
-
The current navigation depth level.
Return values
bool —True if submenu parsing is configured; otherwise, false.
loadBulkLevelSelectors()
Checks for [[LEVELS_FULL]], [[levels_full]] or [[LEVELS_BRANCH]] placeholders. If any of those are present, enable parsing of all levels in either full (if [[LEVELS_FULL]] or [[levels_full]] is present) or branch (if [[LEVELS_BRANCH]] is present) mode.
protected
loadBulkLevelSelectors() : void
loadLevelsFromBlocks()
Sets levels to parse based on the presence of template blocks.
protected
loadLevelsFromBlocks() : void
In case any bulk (static::loadBulkLevelSelectors()) or
specific (static::loadSpecificLevelSelectors) levels have already
been set, then this does nothing. Otherwise it will check for the presence
of the level block. If present, all levels will be parsed. Alternatively,
only those levels will be parsed for which a matching template block exists.
I.e.: level_1
loadSpecificLevelSelectors()
Sets the levels to parse based on matched placeholders of the format: `LEVELS_{start}_{end}[_TYPE]` Where: - start/end can be numeric, `PREVIOUS`, `CURRENT`, `NEXT`, or `NOLIMIT` - TYPE can be `FULL` (default) or `BRANCH`
protected
loadSpecificLevelSelectors() : void
postRender()
protected
postRender(mixed $lang) : mixed
Parameters
- $lang : mixed
postRenderElement()
protected
postRenderElement(mixed $level, mixed $hasChilds, mixed $lang, mixed $page) : mixed
Parameters
- $level : mixed
- $hasChilds : mixed
- $lang : mixed
- $page : mixed
preRender()
Sets the version based on [[V<version>]] placeholders
protected
preRender(mixed $lang) : mixed
Parameters
- $lang : mixed
preRenderElement()
protected
preRenderElement(mixed $level, mixed $hasChilds, mixed $lang, mixed $page) : mixed
Parameters
- $level : mixed
- $hasChilds : mixed
- $lang : mixed
- $page : mixed
realPreRender()
protected
realPreRender(mixed $lang) : mixed
Prepares the level configuration before rendering, based on template placeholders and blocks.
This method orchestrates the loading of level selectors in a priority order:
- Bulk level selectors
- Specific level selectors
- Levels from template blocks
- Fallback levels
Parameters
- $lang : mixed
renderElement()
Override this to do your representation of the tree.
protected
renderElement(mixed $title, mixed $level, mixed $hasChilds, mixed $lang, mixed $path, mixed $current, mixed $page) : string
Parameters
- $title : mixed
- $level : mixed
-
0-based level of the element
- $hasChilds : mixed
-
are there children of this element? if yes, they will be processed in the subsequent calls.
- $lang : mixed
-
language id
- $path : mixed
-
path to this element, e.g. '/CatA/CatB'
- $current : mixed
-
if a $currentPage has been specified, this will be set to true if either a parent element of the current element or the current element itself is rendered.
- $page : mixed
Return values
string —your string representation of the element.
renderFooter()
protected
renderFooter(mixed $lang) : mixed
Parameters
- $lang : mixed
renderHeader()
protected
renderHeader(mixed $lang) : mixed
Parameters
- $lang : mixed