You are here

function TaxonomyMenuTreeNode::__construct in Taxonomy menu 7

File

./taxonomy_menu.test, line 248
Tests for taxonomy_menu.module.

Class

TaxonomyMenuTreeNode
Helper class to build the tree and keep data on hand.

Code

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);
    }
  }
}