summaryrefslogtreecommitdiff
path: root/modules/system/system.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-09-22 15:26:46 +0000
committerDries Buytaert <dries@buytaert.net>2009-09-22 15:26:46 +0000
commit5679074858186e09defac5c303e41512b98d0722 (patch)
tree3f325213ea02509ec8ce4c9c186d34e83bc403b6 /modules/system/system.module
parent29addd06b26192f0d3e1761e7e13b291baf7c5a1 (diff)
downloadbrdo-5679074858186e09defac5c303e41512b98d0722.tar.gz
brdo-5679074858186e09defac5c303e41512b98d0722.tar.bz2
- Patch #550718 by alexanderpas, Gábor Hojtsy | Dries, webchick, ugerhard: tabs on admin pages are not accessible from overviews and menus.
Diffstat (limited to 'modules/system/system.module')
-rw-r--r--modules/system/system.module34
1 files changed, 29 insertions, 5 deletions
diff --git a/modules/system/system.module b/modules/system/system.module
index 8a9fad8c5..fa308f81b 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -564,6 +564,7 @@ function system_menu() {
);
$items['admin/appearance/settings'] = array(
'title' => 'Configure',
+ 'description' => 'Configure default and theme specific settings.',
'page arguments' => array('system_theme_settings'),
'access arguments' => array('administer site configuration'),
'type' => MENU_LOCAL_TASK,
@@ -1661,12 +1662,26 @@ function system_admin_menu_block($item) {
}
$content = array();
+ $default_task = NULL;
+ $has_subitems = FALSE;
$result = db_query("
- SELECT m.load_functions, m.to_arg_functions, m.access_callback, m.access_arguments, m.page_callback, m.page_arguments, m.title, m.title_callback, m.title_arguments, m.type, m.description, ml.*
- FROM {menu_links} ml
- LEFT JOIN {menu_router} m ON ml.router_path = m.path
- WHERE ml.plid = :plid AND ml.menu_name = :name AND hidden = 0", array(':plid' => $item['mlid'], ':name' => $item['menu_name']), array('fetch' => PDO::FETCH_ASSOC));
+ SELECT m.load_functions, m.to_arg_functions, m.access_callback, m.access_arguments, m.page_callback, m.page_arguments, m.title, m.title_callback, m.title_arguments, m.type, m.description, m.path, m.weight as router_weight, ml.*
+ FROM {menu_router} m
+ LEFT JOIN {menu_links} ml ON m.path = ml.router_path
+ WHERE (ml.plid = :plid AND ml.menu_name = :name AND hidden = 0) OR (m.tab_parent = :path AND m.type IN (:local_task, :default_task))", array(':plid' => $item['mlid'], ':name' => $item['menu_name'], ':path' => $item['path'], ':local_task' => MENU_LOCAL_TASK, ':default_task' => MENU_DEFAULT_LOCAL_TASK), array('fetch' => PDO::FETCH_ASSOC));
foreach ($result as $link) {
+ if (!isset($link['link_path'])) {
+ // If this was not an actual link, fake the tab as a menu link, so we
+ // don't need to special case it beyond this point.
+ $link['link_title'] = $link['title'];
+ $link['link_path'] = $link['path'];
+ $link['options'] = 'a:0:{}';
+ $link['weight'] = $link['router_weight'];
+ }
+ else {
+ // We found a non-tab subitem, remember that.
+ $has_subitems = TRUE;
+ }
_menu_link_translate($link);
if (!$link['access']) {
continue;
@@ -1678,7 +1693,16 @@ function 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.
- $content[(50000 + $link['weight']) . ' ' . drupal_strtolower($link['title']) . ' ' . $link['mlid']] = $link;
+ $key = (50000 + $link['weight']) . ' ' . drupal_strtolower($link['title']) . ' ' . $link['mlid'];
+ $content[$key] = $link;
+ if ($link['type'] == MENU_DEFAULT_LOCAL_TASK) {
+ $default_task = $key;
+ }
+ }
+ if ($has_subitems) {
+ // If we've had at least one non-tab subitem, remove the link for the
+ // default task, since that is already broken down to subitems.
+ unset($content[$default_task]);
}
ksort($content);
$cache[$item['mlid']] = $content;