diff --git a/panopoly_widgets.module b/panopoly_widgets.module index 4123c59..555f50d 100644 --- a/panopoly_widgets.module +++ b/panopoly_widgets.module @@ -496,7 +496,7 @@ function panopoly_widgets_file_type_alter(&$types, $file) { */ function panopoly_widgets_menu_block_tree_alter(&$tree, $config) { // Only alter if 'expanded' is enabled and the max isn't 'Expand all children' - if ($config['expanded'] && $config['expanded_max_depth'] > 0) { + if ($config['expanded'] && isset($config['expanded_max_depth']) && $config['expanded_max_depth'] > 0) { _panopoly_widgets_menu_block_tree_expanded_max_depth_alter($tree, $config); } @@ -515,11 +515,7 @@ function panopoly_widgets_menu_block_tree_alter(&$tree, $config) { function _panopoly_widgets_menu_block_tree_expanded_max_depth_alter(&$tree, $config) { // Remove all items above the max depth. foreach ($tree as $name => &$item) { - if ($item['link']['in_active_trail']) { - // Leave anything in the active trail alone. - continue; - } - if ($item['link']['depth'] > $config['expanded_max_depth']) { + if (!$item['link']['in_active_trail'] && $item['link']['depth'] > $config['expanded_max_depth']) { unset($tree[$name]); } else {