diff --git modules/system/system.admin.inc modules/system/system.admin.inc index c10a290..176780c 100644 --- modules/system/system.admin.inc +++ modules/system/system.admin.inc @@ -44,9 +44,11 @@ function system_main_admin_page($arg = NULL) { if ($item['block_callback'] && function_exists($item['block_callback'])) { $function = $item['block_callback']; $block['content'] .= $function(); + $block['show'] = TRUE; } $content = system_admin_menu_block($item); - if ((isset($item['page_callback']) && !in_array($item['page_callback'], array('system_admin_menu_block_page', 'system_admin_config_page', 'system_settings_overview'))) || count($content)) { + $admin_block_callbacks = variable_get('system_admin_block_callbacks', array('system_admin_menu_block_page', 'system_admin_config_page', 'system_settings_overview')); + if ((isset($item['page_callback']) && !in_array($item['page_callback'], $admin_block_callbacks)) || count($content)) { // Only show blocks for items which are not containers, or those which // are containers and do have items we can show. $block['show'] = TRUE; @@ -57,7 +59,9 @@ function system_main_admin_page($arg = NULL) { } // Prepare for sorting as in function _menu_tree_check_access(). // The weight is offset so it is always positive, with a uniform 5-digits. - $blocks[(50000 + $item['weight']) . ' ' . $item['title'] . ' ' . $item['mlid']] = $block; + if ($block['show']) { + $blocks[(50000 + $item['weight']) . ' ' . $item['title'] . ' ' . $item['mlid']] = $block; + } } } if ($blocks) { @@ -101,10 +105,14 @@ function system_admin_config_page() { $function = $item['block_callback']; $block['content'] .= $function(); } - $block['content'] .= theme('admin_block_content', array('content' => system_admin_menu_block($item))); - // Prepare for sorting as in function _menu_tree_check_access(). - // The weight is offset so it is always positive, with a uniform 5-digits. - $blocks[(50000 + $item['weight']) . ' ' . $item['title'] . ' ' . $item['mlid']] = $block; + $content = system_admin_menu_block($item); + // A block with no content and no links is suppressed. + if ($content || $block['content']) { + $block['content'] .= theme('admin_block_content', array('content' => $content)); + // Prepare for sorting as in function _menu_tree_check_access(). + // The weight is offset so it is always positive, with a uniform 5-digits. + $blocks[(50000 + $item['weight']) . ' ' . $item['title'] . ' ' . $item['mlid']] = $block; + } } } if ($blocks) { diff --git modules/system/system.module modules/system/system.module index 6c4fa3a..2b13495 100644 --- modules/system/system.module +++ modules/system/system.module @@ -1967,7 +1967,7 @@ function system_admin_menu_block($item) { if (isset($cache[$item['mlid']])) { return $cache[$item['mlid']]; } - + $admin_block_callbacks = variable_get('system_admin_block_callbacks', array('system_admin_menu_block_page', 'system_admin_config_page', 'system_settings_overview')); $content = array(); $default_task = NULL; $has_subitems = FALSE; @@ -1985,6 +1985,9 @@ function system_admin_menu_block($item) { $link['options'] = 'a:0:{}'; $link['weight'] = $link['router_weight']; } + elseif (empty($link['has_children']) && in_array($item['page_callback'], $admin_block_callbacks)) { + continue; + } else { // We found a non-tab subitem, remember that. $has_subitems = TRUE;