class Component extends Node

A Component type of node for MenuTree

Methods

__construct( string $title, string $element, string $link, string $target = null, string $class = null, string $id = null, string $icon = null)

Constructor for the class.

addChild( Node $child)

Add child to this node

from Node
void
removeChild( Node $child)

Remove a child from this node

from Node
boolean
hasParent()

Test if this node has a parent

from Node
getParent()

Get the parent of this node

from Node
boolean
hasChildren()

Test if this node has children

from Node
Node[]
getChildren()

Get the children of this node

from Node
integer
getLevel()

Find the current node depth in the tree hierarchy

from Node
boolean
isRoot()

Check whether the object instance node is the root node

from Node
void
setActive( bool $active)

Set the active state on or off

from Node
void
setParams( Registry $params)

set the params array

from Node
mixed
getParam( string $key)

Get the param value from the node params

from Node
mixed
get( string $name)

Get an attribute value

Details

__construct( string $title, string $element, string $link, string $target = null, string $class = null, string $id = null, string $icon = null)

Constructor for the class.

Parameters

string $title The title of the node
string $element The component name
string $link The node link
string $target The link target
string $class The CSS class for the node
string $id The node id
string $icon The title icon for the node

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