<?php


namespace App\Components\Sidebar\SidebarMenu;


use App\Components\Sidebar\SidebarMenu\Controls\Header;
use App\Components\Sidebar\SidebarMenu\Controls\Link;
use App\Components\Sidebar\SidebarMenu\Controls\LinkGroup;

trait TSidebarMenuNode
{
    public function addHeader($name, $text)
    {
        $header = new Header($this, $name);
        $header->setText($text);
        return $header;
    }

    public function addLinkGroup($name, $text)
    {
        $group = new LinkGroup($this, $name);
        $group->setText($text);
        return $group;
    }

    public function addLink($name, $text, $destination, $params = array())
    {
        $link = new Link($this, $name);
        $link->setText($text);
        $link->setLink($destination, $params);
        return $link;
    }

}