class TaxonomyMenuTreeNode in Taxonomy menu 7
Helper class to build the tree and keep data on hand.
Hierarchy
- class \TaxonomyMenuTreeNode
Expanded class hierarchy of TaxonomyMenuTreeNode
File
- ./
taxonomy_menu.test, line 247 - Tests for taxonomy_menu.module.
View source
class TaxonomyMenuTreeNode {
function __construct(&$testcase, $parent, $name, $children) {
$this->name = $name;
$this->children = array();
$this->parent = $parent;
$this->term = $testcase
->createNewTerm($testcase->vocabulary, $name, $parent ? $parent->term : NULL);
taxonomy_term_save($this->term);
if (is_array($children)) {
foreach ($children as $name => $grandchildren) {
$this->children[$name] = new TaxonomyMenuTreeNode($testcase, $this, $name, $grandchildren);
}
}
}
function display($level = "") {
foreach ($this->children as $child) {
$child
->display($level . " ");
}
}
}