public function renderCheeseburgerMenuBlock::generateTree in Cheeseburger Menu 8
Same name and namespace in other branches
- 8.2 src/Controller/RenderCheeseburgerMenuBlock.php \Drupal\cheeseburger_menu\Controller\RenderCheeseburgerMenuBlock::generateTree()
- 8.3 src/Controller/RenderCheeseburgerMenuBlock.php \Drupal\cheeseburger_menu\Controller\RenderCheeseburgerMenuBlock::generateTree()
Generate menu tree.
1 call to renderCheeseburgerMenuBlock::generateTree()
- renderCheeseburgerMenuBlock::render_tree in src/
Controller/ renderCheeseburgerMenuBlock.php
File
- src/
Controller/ renderCheeseburgerMenuBlock.php, line 509
Class
Namespace
Drupal\cheeseburger_menu\ControllerCode
public function generateTree($array, $parent = 0) {
$tree = [];
foreach ($array as $item) {
if (reset($item['parents']) == $parent) {
$item['subitem'] = isset($item['subitem']) ? $item['subitem'] : $this
->generateTree($array, $item['id']);
$tree[] = $item;
}
}
return $tree;
}