You are here

function admin_menu_dropdown_menu in Admin Menu Hider 5

Same name and namespace in other branches
  1. 5.2 admin_menu_dropdown.module \admin_menu_dropdown_menu()
  2. 6.2 admin_menu_dropdown.module \admin_menu_dropdown_menu()
  3. 7.2 admin_menu_dropdown.module \admin_menu_dropdown_menu()

Implementation of hook_menu().

File

./admin_menu_dropdown.module, line 11
Makes drupal administration menu able to be hidden or shown by pressing key combo

Code

function admin_menu_dropdown_menu($may_cache) {
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/settings/admin_menu_dropdown',
      'title' => t('Admin menu dropdown'),
      'access' => user_access('administer site configuration'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'admin_menu_dropdown_settings',
      ),
      'description' => t('Edit the settings for Admin Menu Dropdown'),
      'type' => MENU_NORMAL_ITEM,
    );
  }
  if (user_access('access administration menu') && !$may_cache) {
    $css = variable_get('admin_menu_dropdown_hide', TRUE) ? 'admin_menu_dropdown.css' : 'admin_menu_dropdown_show.css';
    $js = variable_get('admin_menu_dropdown_hide', TRUE) ? "hidden = 1;" : "hidden = 0;";
    $js .= " visibilityCombo = '" . variable_get('admin_menu_dropdown_visibility_modifier', 'ctrl + alt');
    $js .= variable_get('admin_menu_dropdown_visibility_key', '') ? " + " . variable_get('admin_menu_dropdown_visibility_key', '') . "';" : "';";
    $js .= " disableCombo = '" . variable_get('admin_menu_dropdown_disable_modifier', 'ctrl + alt + shift');
    $js .= variable_get('admin_menu_dropdown_disable_key', '') ? " + " . variable_get('admin_menu_dropdown_disable_key', '') . "';" : "';";
    drupal_add_css(drupal_get_path('module', 'admin_menu_dropdown') . '/' . $css, 'module');
    drupal_add_js($js, 'inline');
    drupal_add_js(drupal_get_path('module', 'admin_menu_dropdown') . '/admin_menu_dropdown.js', 'module');
  }
  return $items;
}