NodeInterface

Extends ImmutableNodeInterface

Interface for a node class

since

4.0.0

package

Application

Methods

addChild

Add child to this node

addChild(\Joomla\CMS\Tree\NodeInterface child) : void

If the child already has a parent, the link is unset

since

4.0.0

Arguments

child

\Joomla\CMS\Tree\NodeInterfaceThe child to be added.

getChildren

Get the children of this node

getChildren(bool recursive = false) : \Joomla\CMS\Tree\NodeInterface[]
inherited
since

4.0.0

Arguments

recursive

boolFalse by default

Response

\Joomla\CMS\Tree\NodeInterface[]The children

getParent

Get the parent of this node

getParent() : \Joomla\CMS\Tree\NodeInterface|null
inherited
since

4.0.0

Response

\Joomla\CMS\Tree\NodeInterface|null

getRoot

Get the root of the tree

getRoot() : \Joomla\CMS\Tree\ImmutableNodeInterface
inherited
since

4.0.0

Response

\Joomla\CMS\Tree\ImmutableNodeInterface

getSibling

Returns the right or left sibling of a node

getSibling(bool right = true) : \Joomla\CMS\Tree\NodeInterface|null
inherited
since

4.0.0

Arguments

right

boolIf set to false, returns the left sibling

Response

\Joomla\CMS\Tree\NodeInterface|nullNodeInterface object of the sibling.

hasChildren

Test if this node has children

hasChildren() : bool
inherited
since

4.0.0

Response

boolTrue if there is a child

hasParent

Test if this node has a parent

hasParent() : bool
inherited
since

4.0.0

Response

boolTrue if there is a parent

removeChild

Remove a specific child

removeChild(\Joomla\CMS\Tree\NodeInterface child) : void
since

4.0.0

Arguments

child

\Joomla\CMS\Tree\NodeInterfaceChild to remove

setParent

Set the parent of this node

setParent(\Joomla\CMS\Tree\NodeInterface|null parent) : void

If the node already has a parent, the link is unset

since

4.0.0

Arguments

parent

\Joomla\CMS\Tree\NodeInterface|nullNodeInterface for the parent to be set or null

setSibling

Function to set the left or right sibling of a node

setSibling(\Joomla\CMS\Tree\NodeInterface sibling, bool right = true) : void
since

4.0.0

Arguments

sibling

\Joomla\CMS\Tree\NodeInterfaceNodeInterface object for the sibling

right

boolIf set to false, the sibling is the left one