function admin_menu_links_icon in Administration menu 7.3
Same name and namespace in other branches
- 8.3 admin_menu.inc \admin_menu_links_icon()
- 6.3 admin_menu.inc \admin_menu_links_icon()
Build icon menu links; mostly containing maintenance helpers.
See also
1 call to admin_menu_links_icon()
- admin_menu_output in ./
admin_menu.module - Build the administration menu output.
File
- ./
admin_menu.inc, line 427 - Menu builder functions for Administration menu.
Code
function admin_menu_links_icon() {
$destination = drupal_get_destination();
$links = array(
'#theme' => 'admin_menu_links',
'#wrapper_attributes' => array(
'id' => 'admin-menu-icon',
),
'#weight' => -100,
);
$links['icon'] = array(
'#title' => theme('admin_menu_icon'),
'#attributes' => array(
'class' => array(
'admin-menu-icon',
),
),
'#href' => '<front>',
'#options' => array(
'html' => TRUE,
),
);
// Add link to manually run cron.
$links['icon']['cron'] = array(
'#title' => t('Run cron'),
'#weight' => 50,
'#access' => user_access('administer site configuration'),
'#href' => 'admin/reports/status/run-cron',
'#options' => array(
'query' => array(
'token' => drupal_get_token('run-cron'),
),
),
);
// Add link to run update.php.
$links['icon']['update'] = array(
'#title' => t('Run updates'),
'#weight' => 50,
// @see update_access_allowed()
'#access' => $GLOBALS['user']->uid == 1 || !empty($GLOBALS['update_free_access']) || user_access('administer software updates'),
'#href' => base_path() . 'update.php',
'#options' => array(
'external' => TRUE,
),
);
// Add link to drupal.org.
$links['icon']['drupal.org'] = array(
'#title' => 'Drupal.org',
'#weight' => 100,
'#access' => user_access('display drupal links'),
'#href' => 'http://drupal.org',
);
if (variable_get('admin_menu_issue_queues', TRUE)) {
// Add links to project issue queues.
foreach (module_list(FALSE, TRUE) as $module) {
$info = drupal_parse_info_file(drupal_get_path('module', $module) . '/' . $module . '.info');
if (!isset($info['project']) || isset($links['icon']['drupal.org'][$info['project']])) {
continue;
}
$links['icon']['drupal.org'][$info['project']] = array(
'#title' => t('@project issue queue', array(
'@project' => $info['name'],
)),
'#weight' => $info['project'] == 'drupal' ? -10 : 0,
'#href' => 'http://drupal.org/project/issues/' . $info['project'],
'#options' => array(
'query' => array(
'version' => isset($info['core']) ? $info['core'] : 'All',
),
),
);
}
}
// Add items to flush caches.
$links['icon']['flush-cache'] = array(
'#title' => t('Flush all caches'),
'#weight' => 20,
'#access' => user_access('flush caches'),
'#href' => 'admin_menu/flush-cache',
'#options' => array(
'query' => $destination + array(
'token' => drupal_get_token('admin_menu/flush-cache'),
),
),
);
$caches = module_invoke_all('admin_menu_cache_info');
foreach ($caches as $name => $cache) {
$links['icon']['flush-cache'][$name] = array(
'#title' => $cache['title'],
'#href' => 'admin_menu/flush-cache/' . $name,
'#options' => array(
'query' => $destination + array(
'token' => drupal_get_token('admin_menu/flush-cache/' . $name),
),
),
);
}
// Add Devel module menu links.
if (module_exists('devel')) {
$devel_tree = menu_build_tree('devel');
$devel_links = admin_menu_links_menu($devel_tree);
if (element_get_visible_children($devel_links)) {
$links['icon']['devel'] = array(
'#title' => t('Development'),
'#weight' => 30,
) + $devel_links;
}
}
return $links;
}