/** * Ajoute une sous-branche à l'arbre * * @access public * @param string $id L'id de la sous-branche * @param string $txt Le texte de la sous-branche * @param array $options Les informations complémentaires * @return TafelTreeBranch La sous-branche */ public function addBranch($id, $txt, $options = array()) { $branch = new TafelTreeBranch(); $branch->setId($id); $branch->setText($txt); foreach ($options as $property => $value) { if ($property != 'items') { $branch->setParam($property, $value); } } if (isset($options['items'])) { foreach ($options['items'] as $opt) { $branch->addBranch(null, null, $opt); } } if (!isset($this->items)) { $this->items = array(); } $this->items[] = $branch; return $branch; }