NavbarNavigationPageTree
extends SigmaPageTree
in package
SigmaPageTree
Tags
Table of Contents
Constants
- StyleNameActive = "active"
- StyleNameActiveStarter = 'starter_active'
- StyleNameMenuNode = 'menu_node'
- StyleNameNormal = "inactive"
- StyleNameNormalStarter = 'starter_normal'
- BLOCK_PREFIX = 'level'
- Prefix of the template block that defines a navigation level
- HAS_SUBMENU_SUFFIX = '_has_sub_menu'
- Suffix of the template block to be used as alternative to {@see NavbarNavigationPageTree::BLOCK_PREFIX} for pages having children
- SUBMENU_SUFFIX = '_sub_menu'
- Suffix of the template block that defines the block to include the sub-navigation of a page
- TEMPLATE_TYPE_LEVEL = 1
- Identifier for the 'level' tempalte block
- TEMPLATE_TYPE_LEVEL_HAS_SUBMENU = 2
- Identifier for the 'has_sub_menu' tempalte block
- TEMPLATE_TYPE_SUBMENU = 3
- Identifier for the 'sub_menu' tempalte block
- TEMPLATE_TYPES = [self::TEMPLATE_TYPE_LEVEL => self::BLOCK_PREFIX, self::TEMPLATE_TYPE_LEVEL_HAS_SUBMENU => self::HAS_SUBMENU_SUFFIX, self::TEMPLATE_TYPE_SUBMENU => self::SUBMENU_SUFFIX]
- 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
- $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
- 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
- Called on construction. Override if you do not want to override the ctor.
- initLevel() : void
- Initializes the template configuration for a given navigation level.
- injectSubnavigation() : void
- This method fills out the placeholder {SUB_MENU} of the previous parsed page.
- isSubMenuParsingSetup() : bool
- Determines whether submenu parsing is set up for a given level.
- 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
- injectParsedSubnavigations() : 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'
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'
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' tempalte block
protected
int
TEMPLATE_TYPE_LEVEL
= 1
TEMPLATE_TYPE_LEVEL_HAS_SUBMENU
Identifier for the 'has_sub_menu' tempalte block
protected
int
TEMPLATE_TYPE_LEVEL_HAS_SUBMENU
= 2
TEMPLATE_TYPE_SUBMENU
Identifier for the 'sub_menu' tempalte 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_HAS_SUBMENU => self::HAS_SUBMENU_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
$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().
Tags
$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
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()
Called on construction. Override if you do not want to override the ctor.
protected
init() : mixed
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.
injectSubnavigation()
This method fills out the placeholder {SUB_MENU} of the previous parsed page.
protected
injectSubnavigation(mixed $level) : void
Parameters
- $level : mixed
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.
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
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
injectParsedSubnavigations()
private
injectParsedSubnavigations([mixed $currentLevel = 1 ]) : mixed
Parameters
- $currentLevel : mixed = 1