function tb_megamenu_check_access in The Better Mega Menu 2.x
Same name and namespace in other branches
- 8 tb_megamenu.module \tb_megamenu_check_access()
Recursively remove menu items without access rights.
Parameters
array $menu_items: Menu section to check.
1 call to tb_megamenu_check_access()
- template_preprocess_tb_megamenu in ./
tb_megamenu.module - Prepare variables for tb_megamenu.
File
- ./
tb_megamenu.module, line 731 - TB Mega Menu.
Code
function tb_megamenu_check_access(array &$menu_items) {
foreach ($menu_items as $route => &$item) {
if ($item->access instanceof AccessResultInterface && !$item->access
->isAllowed()) {
unset($menu_items[$route]);
continue;
}
if ($item->hasChildren) {
tb_megamenu_check_access($item->subtree);
}
}
}