NodeInterface
Extends ImmutableNodeInterfaceInterface for a node class
since |
4.0.0 |
---|---|
package |
Joomla CMS |
Methods
addChild
Add child to this node
addChild(\Joomla\CMS\Tree\NodeInterface child) :
If the child already has a parent, the link is unset
since |
4.0.0 |
---|
Arguments
- child
NodeInterface
The child to be added.
Response
void
getChildren
Get the children of this node
getChildren( recursive = false) : \Joomla\CMS\Tree\NodeInterface||string|int
since |
4.0.0 |
---|
Arguments
- recursive
bool
False by default
Response
array<string|int, NodeInterface>
The children
getParent
Get the parent of this node
getParent() : \Joomla\CMS\Tree\NodeInterface|null
getRoot
Get the root of the tree
getRoot() : \Joomla\CMS\Tree\ImmutableNodeInterface
getSibling
Returns the right or left sibling of a node
getSibling( right = true) : \Joomla\CMS\Tree\NodeInterface|null
since |
4.0.0 |
---|
Arguments
- right
bool
If set to false, returns the left sibling
Response
NodeInterface|null
NodeInterface object of the sibling.
hasChildren
Test if this node has children
hasChildren() :
since |
4.0.0 |
---|
Response
bool
True if there is a child
hasParent
Test if this node has a parent
hasParent() :
since |
4.0.0 |
---|
Response
bool
True if there is a parent
removeChild
Remove a specific child
removeChild(\Joomla\CMS\Tree\NodeInterface child) :
setParent
Set the parent of this node
setParent(\Joomla\CMS\Tree\NodeInterface parent) :
If the node already has a parent, the link is unset
since |
4.0.0 |
---|
Arguments
- parent
NodeInterface
NodeInterface for the parent to be set
Response
void
setSibling
Function to set the left or right sibling of a node
setSibling(\Joomla\CMS\Tree\NodeInterface sibling, right = true) :
since |
4.0.0 |
---|
Arguments
- sibling
NodeInterface
NodeInterface object for the sibling- right
bool
If set to false, the sibling is the left one
Response
void