View source
<?php
function admin_menu_help($section) {
switch ($section) {
case 'admin/modules#description':
return t("Renders the administer menu tree as dropdown menu at the top of the window.");
}
}
function admin_menu_perm() {
return array(
'access administration menu',
);
}
function admin_menu_menu($may_cache) {
$items = array();
if (!user_access('access administration menu')) {
return $items;
}
$path = drupal_get_path('module', 'admin_menu');
drupal_add_css($path . '/admin_menu.css', 'module', 'screen', false);
$ie_header = '<!--[if lt IE 7]>';
$ie_header .= '<script type="text/javascript" src="' . base_path() . $path . '/admin_menu.js' . '"></script>';
$ie_header .= '<![endif]-->';
drupal_set_html_head($ie_header);
return $items;
}
function admin_menu_footer($main) {
if (!user_access('access administration menu')) {
return;
}
global $user, $locale;
$cid = $user->uid . ':' . $locale . ':admin_menu';
$cache = cache_get($cid, 'cache_menu');
if ($cache) {
$admin_menu = $cache->data;
}
else {
require_once drupal_get_path('module', 'admin_menu') . '/admin_menu.inc';
$admin_menu = admin_menu_get_menu();
cache_set($cid, 'cache_menu', $admin_menu, time() + 60 * 60 * 24);
}
$content = '<div id="admin_menu">';
$content .= theme('admin_menu_icon');
$content .= $admin_menu;
$content .= '</div>';
return $content;
}
function theme_admin_menu_icon() {
$output = '<img id="admin_menu_icon" src="' . check_url(base_path() . 'misc/favicon.ico') . '" width="16" height="16" alt="" border="0" />';
return $output;
}
function admin_menu_form_alter($form_id, &$form) {
if ($form_id == 'devel_admin_settings') {
$weight = $form['buttons']['#weight'];
$form['buttons']['#weight'] = $weight + 1;
$form['admin_menu'] = array(
'#type' => 'fieldset',
'#title' => t('Administration Menu settings'),
'#collapsible' => true,
'#collapsed' => true,
);
$form['admin_menu']['admin_menu_show_item_ids'] = array(
'#type' => 'checkbox',
'#title' => t('Display menu item IDs in Drupal Administration Menu'),
'#default_value' => variable_get('admin_menu_show_item_ids', 0),
'#description' => t('If enabled, the corresponding menu item id will appear next to each menu item link.'),
);
$form['admin_menu']['admin_menu_show_all'] = array(
'#type' => 'checkbox',
'#title' => t('Display all menu items'),
'#default_value' => variable_get('admin_menu_show_all', 0),
'#description' => t('Enable this option to disable user access checks for menu items, i.e. every menu item in the visible menu tree will be displayed to every user regardless of access permissions.'),
);
}
}