#116317, disable simplemenu on a per theme basis, patch by jjeff

This commit is contained in:
Ted Serbinski 2007-02-28 23:43:42 +00:00
parent 659a21255a
commit cd38617398

View File

@ -29,9 +29,18 @@ function simplemenu_menu($may_cache) {
'access' => user_access('administer simplemenu')
);
}
// We put this in !$may_cache so it's only added once per request
elseif (user_access('view simplemenu')) {
return $items;
}
/**
* Implementation of hook_footer()
*/
function simplemenu_footer() {
global $theme;
$exclusions = variable_get('simplemenu_exclusions', array());
if (user_access('view simplemenu') && !$exclusions[$theme]) {
global $theme, $custom_theme;
$path = drupal_get_path('module', 'simplemenu');
drupal_add_css($path .'/simplemenu.css');
@ -46,8 +55,6 @@ function simplemenu_menu($may_cache) {
drupal_add_js(array('simplemenu' => $settings), 'setting');
drupal_add_js($path .'/simplemenu.js');
}
return $items;
}
/**
@ -100,6 +107,14 @@ function simplemenu_admin_settings() {
'#required' => TRUE
);
$form['default_menu']['advanced']['simplemenu_exclusions'] = array(
'#type' => 'checkboxes',
'#title' => 'Theme exclusions',
'#options' => drupal_map_assoc(array_keys(list_themes())),
'#default_value' => variable_get('simplemenu_exclusions', array()),
'#description' => t('Select which themes to <strong>not</strong> display the menu. Use this when you have a theme that displays its own admin navigation.'),
);
return system_settings_form($form);
}