public function AppService::renderMenu in Forena Reports 8
Render an application menu based on provided id and max depth.
Parameters
$menu_id:
$max_depth:
Return value
mixed
1 method overrides AppService::renderMenu()
- TestingAppService::renderMenu in tests/
src/ Unit/ Mock/ TestingAppService.php
File
- src/
AppService.php, line 400
Class
Namespace
Drupal\forenaCode
public function renderMenu($menu_id, $options = []) {
$menu_tree_service = \Drupal::service('menu.link_tree');
$menu_parameters = new \Drupal\Core\Menu\MenuTreeParameters();
$tree = $menu_tree_service
->load($menu_id, $menu_parameters);
$manipulators = [
[
'callable' => 'menu.default_tree_manipulators:checkNodeAccess',
],
[
'callable' => 'menu.default_tree_manipulators:checkAccess',
],
[
'callable' => 'menu.default_tree_manipulators:generateIndexAndSort',
],
];
$tree = $menu_tree_service
->transform($tree, $manipulators);
$content = $menu_tree_service
->build($tree);
return (string) \Drupal::service('renderer')
->render($content);
}