add() public method

Add a item to the default menu Menu::add('home', 'Homepage'); Add a item with a subitem to the default menu Menu::add('home', 'Homepage', Menu::items()->add('home/sub', 'Subitem')); Add a item with attributes for the item's HTML element Menu::add('home', 'Homepage', null, array('class' => 'fancy'));
public add ( string $url, string $value, ItemList $children = null, array $linkAttributes = [], array $itemAttributes = [], string $itemElement = null, string $beforeContent = null, string $afterContent = null ) : ItemList
$url string Url of the link
$value string (H)T(ML) inside of the link
$children ItemList Children
$linkAttributes array Attributes for the link
$itemAttributes array Attributes for the item
$itemElement string The element for the item
$beforeContent string String to add before the link
$afterContent string String to add after the link
return ItemList
Beispiel #1
0
 public function testMenuCanSetGlobalOptions()
 {
     Menu::setOption('item.element', 'dl');
     $list = new ItemList();
     $list->add('#', 'foo');
     $this->assertHTML($this->matchListWithItem('ul', 'dl'), $list->render());
     $this->assertHTML($this->matchLink(), $list->render());
 }