Tree

Menu Tree class to represent a menu tree hierarchy

since

3.8.0

Methods

__construct

Constructor

__construct() 
since

3.8.0

addChild

Method to add a child

addChild(\Joomla\CMS\Menu\Node $node, boolean $setCurrent = false) : \Joomla\CMS\Menu\Node
since

3.8.0

Arguments

$node

\Joomla\CMS\Menu\NodeThe node to process

$setCurrent

booleanSet this new child as the current node for further working

Response

\Joomla\CMS\Menu\NodeThe newly added node

getCss

Get the CSS declarations for this tree

getCss() : array<mixed,string>
since

3.8.0

Response

array<mixed,string>

getCurrent

Get the current node

getCurrent() : \Joomla\CMS\Menu\Node
since

3.8.0

Response

\Joomla\CMS\Menu\Node

getIconClass

Method to get the CSS class name for an icon identifier or create one if a custom image path is passed as the identifier

getIconClass() : string
since

3.8.0

Response

stringCSS class name

getParent

Method to get the parent and set it as active optionally

getParent(boolean $setCurrent = true) : \Joomla\CMS\Menu\Node
since

3.8.0

Arguments

$setCurrent

booleanSet that parent as the current node for further working

Response

\Joomla\CMS\Menu\Node

getRoot

Get the root node

getRoot() : \Joomla\CMS\Menu\Node
since

3.8.0

Response

\Joomla\CMS\Menu\Node

reset

Method to reset the working pointer to the root node and optionally clear all menu nodes

reset(boolean $clear = false) : \Joomla\CMS\Menu\Node
since

3.8.0

Arguments

$clear

booleanWhether to clear the existing menu items or just reset the pointer to root element

Response

\Joomla\CMS\Menu\NodeThe root node

setCurrent

Get the current node

setCurrent(\Joomla\CMS\Menu\Node $node) : void
since

3.8.0

Arguments

$node

\Joomla\CMS\Menu\NodeThe node to be set as current

Properties

root

The root menu node

since

3.8.0

Type(s)

\Joomla\CMS\Menu\Node

current

The current working menu node

since

3.8.0

Type(s)

\Joomla\CMS\Menu\Node

css

The CSS style array

since

3.8.0

Type(s)

array<mixed,string>