Sulu\Bundle\AdminBundle\Navigation\NavigationItem::copyChildless PHP Method

copyChildless() public method

Returns a copy of this navigation item without its children.
public copyChildless ( ) : NavigationItem
return NavigationItem
    public function copyChildless()
    {
        $new = $this->copyWithName();
        $new->setAction($this->getAction());
        $new->setEvent($this->getEvent());
        $new->setEventArguments($this->getEventArguments());
        $new->setIcon($this->getIcon());
        $new->setHeaderIcon($this->getHeaderIcon());
        $new->setHeaderTitle($this->getHeaderTitle());
        $new->setId($this->getId());
        $new->setHasSettings($this->getHasSettings());
        $new->setPosition($this->getPosition());
        return $new;
    }

Usage Example

Example #1
0
 public function testCopyChildless()
 {
     $copy = $this->item1->copyChildless();
     $this->assertEquals($this->item1->getAction(), $copy->getAction());
     $this->assertEquals($this->item1->getIcon(), $copy->getIcon());
     $this->assertEquals($this->item1->getHeaderIcon(), $copy->getHeaderIcon());
     $this->assertEquals($this->item1->getHeaderTitle(), $copy->getHeaderTitle());
     $this->assertEquals($this->item1->getId(), $copy->getId());
 }