function admin_menu_links_icon

nittany7 admin_menu.inc admin_menu_links_icon()
cis7 admin_menu.inc admin_menu_links_icon()
mooc7 admin_menu.inc admin_menu_links_icon()

Build icon menu links; mostly containing maintenance helpers.

See also

theme_admin_menu_links()

1 call to admin_menu_links_icon()
admin_menu_output in modules/contrib/admin_menu/admin_menu.module
Build the administration menu output.

File

modules/contrib/admin_menu/admin_menu.inc, line 423
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',
  );
  // 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',
  );
  // 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 link to toggle developer modules (performance).
  $saved_state = variable_get('admin_menu_devel_modules_enabled', NULL);
  $links['icon']['toggle-modules'] = array(
    '#title' => isset($saved_state) ? t('Enable developer modules') : t('Disable developer modules'),
    '#weight' => 88,
    '#access' => user_access('administer modules'),
    '#href' => 'admin_menu/toggle-modules',
    '#options' => array(
      'query' => $destination + array('token' => drupal_get_token('admin_menu/toggle-modules')),
    ),
  );

  // 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;
}