Commit a4a82f68 authored by Igor Biki's avatar Igor Biki
Browse files

ISTWCMS-3830 Covering case where user don't have access to any submenu items.

parent e06c0f61
......@@ -46,14 +46,18 @@ class ContentManagementMenuBlock extends BlockBase implements ContainerFactoryPl
// Get secondary (level 2) menu items.
$secondary_menu = $this->processMenuTree($primary_menu_item->subtree);
// If sub menu exists for primary menu item, use it as default, but
// also append new menu items (items that are added after block has
// been configured. If not (else block) use secondary menu by default.
if (isset($configured[$id])) {
$selected_secondary = array_keys(array_filter($configured[$id] + $secondary_menu));
}
else {
$selected_secondary = array_keys($secondary_menu);
$selected_secondary = [];
// Check if user has access to any submenu items. If not, skip.
if (!empty($secondary_menu)) {
// If sub menu exists for primary menu item, use it as default, but
// also append new menu items (items that are added after block has
// been configured. If not (else block) use secondary menu by default.
if (isset($configured[$id])) {
$selected_secondary = array_keys(array_filter($configured[$id] + $secondary_menu));
}
else {
$selected_secondary = array_keys($secondary_menu);
}
}
// Run only if there are menus to display for secondary menu.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment