示例#1
0
 /**
  * Add a child URL.
  *
  * @param T_CompositeLeaf $child  child URL object.
  * @return T_Url_Collection  fluent interface
  */
 function addChild(T_CompositeLeaf $child, $key = null)
 {
     $child->setParent($this);
     if (isset($key)) {
         $this->children[$key] = $child;
     } else {
         $this->children[] = $child;
     }
     if ($child->isActive()) {
         $this->setActive();
     }
     return $this;
 }
示例#2
0
 /**
  * Get the class of a node.
  *
  * @param T_CompositeLeaf $node
  */
 protected function getClass($node)
 {
     $class = false;
     if ($node instanceof T_Url_Leaf) {
         if ($node->isActive()) {
             $class = 'cur ';
         }
         $c = $node->getComposite();
         if ($c && $c->isChildren()) {
             $class .= 'parent';
         }
     }
     return $class ? trim($class) : false;
 }