public function AccordionMenusBlock::generateSubMenuTree in Accordion Menus 8.3
Same name and namespace in other branches
- 8.4 src/Plugin/Block/AccordionMenusBlock.php \Drupal\accordion_menus\Plugin\Block\AccordionMenusBlock::generateSubMenuTree()
- 8 src/Plugin/Block/AccordionMenusBlock.php \Drupal\accordion_menus\Plugin\Block\AccordionMenusBlock::generateSubMenuTree()
- 8.2 src/Plugin/Block/AccordionMenusBlock.php \Drupal\accordion_menus\Plugin\Block\AccordionMenusBlock::generateSubMenuTree()
Generate submenu output.
1 call to AccordionMenusBlock::generateSubMenuTree()
- AccordionMenusBlock::build in src/
Plugin/ Block/ AccordionMenusBlock.php - Builds and returns the renderable array for this block plugin.
File
- src/
Plugin/ Block/ AccordionMenusBlock.php, line 150
Class
- AccordionMenusBlock
- Provides a accordion Menu block.
Namespace
Drupal\accordion_menus\Plugin\BlockCode
public function generateSubMenuTree($sub_menus) {
$items = [];
foreach ($sub_menus as $sub_item) {
// Only render accessible links.
if ($this
->isAccordionMenusLinkInaccessible($sub_item)) {
continue;
}
$items[] = Link::fromTextAndUrl($sub_item->link
->getTitle(), $sub_item->link
->getUrlObject());
}
return [
'#theme' => 'item_list',
'#items' => $items,
];
}