admin_menu_dropdown.module in Admin Menu Hider 6.3
Same filename and directory in other branches
Admin Menu Hider, to keep the admin menu out of the way.
Admin Menu Hider will hide/show the admin menu with the press of a key.
File
admin_menu_dropdown.moduleView source
<?php
/**
* @file
* Admin Menu Hider, to keep the admin menu out of the way.
*
* Admin Menu Hider will hide/show the admin menu with the press of a key.
*/
/**
* Implementation of hook_help().
*/
function admin_menu_dropdown_help($path, $arg) {
switch ($path) {
// Main help
case 'admin/help#admin_menu_dropdown':
return '<p>' . t('Admin Menu Hider toggles the visibility of the Admin Menu with the press of a key. You can configure the key under "Admin Menu Hider Settings" on !admin_menu. I recommend that you also turn on "Keep Menu at top of Page" above the Admin Menu Hider settings, so you won\'t have to scroll up to see the menu. On that page, you can also configure if you would like the menu hidden by default.', array(
'!admin_menu' => l("Admin Menu's settings page", 'admin/settings/admin_menu'),
)) . '</p>';
}
}
/**
* Implements hook_init().
*/
function admin_menu_dropdown_init() {
if (user_access('access administration menu')) {
$path = drupal_get_path('module', 'admin_menu_dropdown');
$settings = array(
'key' => variable_get('admin_menu_dropdown_key', '`'),
'onload' => variable_get('admin_menu_dropdown_default', 1),
);
drupal_add_js($path . '/admin_menu_dropdown.js', 'module', 'header', TRUE, TRUE, FALSE);
drupal_add_js(array(
'admin_menu_dropdown' => $settings,
), 'setting');
drupal_add_css($path . '/admin_menu_dropdown.css', 'theme', 'all', FALSE);
}
}
/**
* Implements hook_form_FORM_ID_alter() for admin_menu_theme_settings().
*/
function admin_menu_dropdown_form_admin_menu_theme_settings_alter(&$form, &$form_state) {
$form['tweaks']['admin_menu_dropdown'] = array(
'#type' => 'fieldset',
'#title' => t('Admin Menu Hider Settings'),
'#description' => t('To be most useful, turn on "Keep Menu at top of Page" above. (Note that this does not work in some browsers!) !help', array(
'!help' => l('More help', 'admin/help/admin_menu_dropdown'),
)),
);
$form['tweaks']['admin_menu_dropdown']['admin_menu_dropdown_default'] = array(
'#type' => 'checkbox',
'#title' => t('Hide by default'),
'#default_value' => variable_get('admin_menu_dropdown_default', 1),
'#description' => t('Hide the admin menu by default.'),
);
$form['tweaks']['admin_menu_dropdown']['admin_menu_dropdown_key'] = array(
'#type' => 'textfield',
'#title' => t('Show/hide key'),
'#size' => 1,
'#maxlength' => 1,
'#default_value' => variable_get('admin_menu_dropdown_key', '`'),
'#description' => t('This key will show/hide the admin menu.'),
'#wysiwyg' => FALSE,
);
}
Functions
Name![]() |
Description |
---|---|
admin_menu_dropdown_form_admin_menu_theme_settings_alter | Implements hook_form_FORM_ID_alter() for admin_menu_theme_settings(). |
admin_menu_dropdown_help | Implementation of hook_help(). |
admin_menu_dropdown_init | Implements hook_init(). |