public function add(navigation_node $node, $beforekey=null) {
        $result = parent::add($node, $beforekey);
        // Extend the parent to get a name for the collection of nodes if required.
        if (empty($this->collectionlabel)) {
            if ($node instanceof flat_navigation_node) {
                $this->set_collectionlabel($node->get_collectionlabel());
            }
        }

        return $result;
    }
public function add(navigation_node $node, $beforekey=null) {
        $result = parent::add($node, $beforekey);
        // Extend the parent to get a name for the collection of nodes if required.
        if (empty($this->collectionlabel)) {
            if ($node instanceof flat_navigation_node) {
                $this->set_collectionlabel($node->get_collectionlabel());
            }
        }

        return $result;
    }
public function add ( navigation_node $ node , $ beforekey = null ) { $ result = parent :: add ( $ node , $ beforekey ) ; // Extend the parent to get a name for the collection of nodes if required. if ( empty ( $ this -> collectionlabel ) ) { if ( $ node instanceof flat_navigation_node ) { $ this -> set_collectionlabel ( $ node -> get_collectionlabel ( ) ) ; } } return $ result ; }
Override the parent so we can set a label for this collection if it has not been set yet.

@param navigation_node $node Node to add
@param string $beforekey If specified, adds before a node with this key,
otherwise adds at end
@return navigation_node Added node
Override the parent so we can set a label for this collection if it has not been set yet .