Index: modules/contextual/contextual.module =================================================================== RCS file: /cvs/drupal/drupal/modules/contextual/contextual.module,v retrieving revision 1.5 diff -u -p -r1.5 contextual.module --- modules/contextual/contextual.module 8 Jan 2010 07:36:53 -0000 1.5 +++ modules/contextual/contextual.module 12 Feb 2010 13:27:17 -0000 @@ -29,10 +29,29 @@ function contextual_help($path, $arg) { * Implements hook_permission(). */ function contextual_permission() { + // Determine if there are any themes that do not support contextual links, + // so that we can add a proper permission description for 'access contextual + // links'. + $themes = list_themes(); + $themes_without_contextual_links = array(); + foreach ($themes as $theme) { + if (drupal_theme_access($theme) && !theme_get_setting('toggle_contextual_links', $theme->name)) { + $themes_without_contextual_links[] = $theme->info['name']; + } + } + if (empty($themes_without_contextual_links)) { + $contextual_links_description = t('Use contextual links to perform actions related to elements on a page.'); + } + elseif (count($themes_without_contextual_links) == 1) { + $contextual_links_description = t('Use contextual links to perform actions related to elements on a page. (Note: The %theme theme is not configured to display contextual links, so this permission will not have an effect when that theme is being used.)', array('%theme' => reset($themes_without_contextual_links))); + } + else { + $contextual_links_description = t('Use contextual links to perform actions related to elements on a page. (Note: The following themes are not configured to display contextual links, so this permission will not have an effect when those themes are being used: %themes)', array('%themes' => implode(', ', $themes_without_contextual_links))); + } return array( 'access contextual links' => array( 'title' => t('Use contextual links'), - 'description' => t('Use contextual links to perform actions related to elements on a page.'), + 'description' => $contextual_links_description, ), ); } @@ -65,7 +84,7 @@ function contextual_preprocess(&$variabl static $hooks; // Nothing to do here if the user is not permitted to access contextual links. - if (!user_access('access contextual links')) { + if (!user_access('access contextual links') || !theme_get_setting('toggle_contextual_links')) { return; } Index: modules/system/system.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.admin.inc,v retrieving revision 1.258 diff -u -p -r1.258 system.admin.inc --- modules/system/system.admin.inc 7 Feb 2010 17:29:09 -0000 1.258 +++ modules/system/system.admin.inc 12 Feb 2010 13:27:44 -0000 @@ -407,6 +407,7 @@ function system_theme_disable() { else { drupal_set_message(t('The %theme theme was not found.', array('%theme' => $theme)), 'error'); } + menu_rebuild(); drupal_goto('admin/appearance'); } return drupal_access_denied(); @@ -483,6 +484,7 @@ function system_theme_settings($form, &$ 'favicon' => t('Shortcut icon'), 'main_menu' => t('Main menu'), 'secondary_menu' => t('Secondary menu'), + 'contextual_links' => t('Contextual links'), ); // Some features are not always available Index: modules/system/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.module,v retrieving revision 1.887 diff -u -p -r1.887 system.module --- modules/system/system.module 7 Feb 2010 17:29:09 -0000 1.887 +++ modules/system/system.module 12 Feb 2010 13:27:49 -0000 @@ -2254,6 +2254,7 @@ function _system_rebuild_theme_data() { 'slogan', 'main_menu', 'secondary_menu', + 'contextual_links', ), 'screenshot' => 'screenshot.png', 'php' => DRUPAL_MINIMUM_PHP,