class Tree

Menu Tree class to represent a menu tree hierarchy

Methods

__construct()

Constructor

getRoot()

Get the root node

getCurrent()

Get the current node

void
setCurrent( Node $node)

Get the current node

getParent( bool $setCurrent = true)

Method to get the parent and set it as active optionally

reset( bool $clear = false)

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

addChild( Node $node, bool $setCurrent = false)

Method to add a child

string
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

string[]
getCss()

Get the CSS declarations for this tree

Details

__construct()

Constructor

Node getRoot()

Get the root node

Return Value

Node

Node getCurrent()

Get the current node

Return Value

Node

void setCurrent( Node $node)

Get the current node

Parameters

Node $node The node to be set as current

Return Value

void

Node getParent( bool $setCurrent = true)

Method to get the parent and set it as active optionally

Parameters

bool $setCurrent Set that parent as the current node for further working

Return Value

Node

Node reset( bool $clear = false)

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

Parameters

bool $clear Whether to clear the existing menu items or just reset the pointer to root element

Return Value

Node The root node

Node addChild( Node $node, bool $setCurrent = false)

Method to add a child

Parameters

Node $node The node to process
bool $setCurrent Set this new child as the current node for further working

Return Value

Node The newly added node

string 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

Return Value

string CSS class name

string[] getCss()

Get the CSS declarations for this tree

Return Value

string[]