protected function MenuLinkTree::addItemContent in Colossal Menu 8
Same name and namespace in other branches
- 2.x src/Menu/MenuLinkTree.php \Drupal\colossal_menu\Menu\MenuLinkTree::addItemContent()
Add the Link Content and add a no link variable.
Parameters
array $tree: Tree of links.
1 call to MenuLinkTree::addItemContent()
- MenuLinkTree::build in src/
Menu/ MenuLinkTree.php - Builds a renderable array from a menu tree.
File
- src/
Menu/ MenuLinkTree.php, line 102
Class
- MenuLinkTree
- Implements the loading, transforming and rendering of menu link trees.
Namespace
Drupal\colossal_menu\MenuCode
protected function addItemContent(array &$tree) {
foreach ($tree as &$item) {
$link = $item['original_link'];
$item['show_title'] = $link
->showTitle();
$item['identifier'] = Html::cleanCssIdentifier($link
->getMachineName());
$item['has_link'] = TRUE;
if (!$link
->isExternal() && $link
->getRouteName() == '<none>') {
$item['has_link'] = FALSE;
}
$item['content'] = $this->entityTypeManager
->getViewBuilder($link
->getEntityTypeId())
->view($link, 'default');
if (!empty($item['below'])) {
$this
->addItemContent($item['below']);
}
}
}