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()); }
public function breadcrumbs() { // Collect all items $activeItem = $this->findActiveItem(); $separator = $this->getOption('item_list.breadcrumb_separator'); // Make the breadcrumbs $itemList = new ItemList(array(), 'breadcrumbs'); // Fill her up if we found the active link if (!is_null($activeItem)) { // Add the found item $itemList->addContent($activeItem->getContent()); // Loop throught the parents until we hit the root while ($nextItem = $activeItem->getParent()) { if (is_null($nextItem->getParent())) { break; } // Add a separator and the link if (!empty($separator)) { $itemList->raw($separator); } $itemList->addContent($nextItem->getParent()->getContent()); // Set the activeItem for the next iteration $activeItem = $nextItem->getParent(); } } // Correct order $itemList->reverse(); return $itemList; }