public function RenderCheeseburgerMenuBlock::generateTree in Cheeseburger Menu 8.3
Same name and namespace in other branches
- 8 src/Controller/renderCheeseburgerMenuBlock.php \Drupal\cheeseburger_menu\Controller\renderCheeseburgerMenuBlock::generateTree()
- 8.2 src/Controller/RenderCheeseburgerMenuBlock.php \Drupal\cheeseburger_menu\Controller\RenderCheeseburgerMenuBlock::generateTree()
Generate menu tree.
1 call to RenderCheeseburgerMenuBlock::generateTree()
- RenderCheeseburgerMenuBlock::renderTree in src/
Controller/ RenderCheeseburgerMenuBlock.php - Render given tree.
File
- src/
Controller/ RenderCheeseburgerMenuBlock.php, line 701 - Controller used for rendering block.
Class
- RenderCheeseburgerMenuBlock
- Class RenderCheeseburgerMenuBlock.
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;
}