class Node

A Node for MenuTree

Methods

__construct()

Constructor

addChild( Node $child)

Add child to this node

void
removeChild( Node $child)

Remove a child from this node

boolean
hasParent()

Test if this node has a parent

getParent()

Get the parent of this node

boolean
hasChildren()

Test if this node has children

Node[]
getChildren()

Get the children of this node

integer
getLevel()

Find the current node depth in the tree hierarchy

boolean
isRoot()

Check whether the object instance node is the root node

void
setActive( bool $active)

Set the active state on or off

void
setParams( Registry $params)

set the params array

mixed
getParam( string $key)

Get the param value from the node params

mixed
get( string $name)

Get an attribute value

Details

__construct()

Constructor

Node addChild( Node $child)

Add child to this node

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

Parameters

Node $child The child to be added

Return Value

Node The new added child

void removeChild( Node $child)

Remove a child from this node

If the child exists it is unset

Parameters

Node $child The child to be added

Return Value

void

boolean hasParent()

Test if this node has a parent

Return Value

boolean True if there is a parent

Node getParent()

Get the parent of this node

Return Value

Node The Node object's parent or null for no parent

boolean hasChildren()

Test if this node has children

Return Value

boolean

Node[] getChildren()

Get the children of this node

Return Value

Node[] The children

integer getLevel()

Find the current node depth in the tree hierarchy

Return Value

integer The node level in the hierarchy, where ROOT == 0, First level menu item == 1, and so on.

boolean isRoot()

Check whether the object instance node is the root node

Return Value

boolean

void setActive( bool $active)

Set the active state on or off

Parameters

bool $active The new active state

Return Value

void

void setParams( Registry $params)

set the params array

Parameters

Registry $params The params attributes

Return Value

void

mixed getParam( string $key)

Get the param value from the node params

Parameters

string $key The param name

Return Value

mixed

mixed get( string $name)

Get an attribute value

Parameters

string $name The attribute name

Return Value

mixed