You are here

function hook_admin_menu_output_alter in Administration menu 6.3

Same name and namespace in other branches
  1. 8.3 admin_menu.api.php \hook_admin_menu_output_alter()
  2. 7.3 admin_menu.api.php \hook_admin_menu_output_alter()

Change the administration menu content before it is rendered.

Parameters

array $content: A structured array suitable for drupal_render(), containing:

  • menu: The administrative menu of links below the path 'admin/*'.
  • icon: The icon menu.
  • user: The user items and links.

Passed by reference.

See also

hook_admin_menu_output_build()

admin_menu_links_menu()

admin_menu_links_icon()

admin_menu_links_user()

theme_admin_menu_links()

1 function implements hook_admin_menu_output_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

admin_menu_toolbar_admin_menu_output_alter in admin_menu_toolbar/admin_menu_toolbar.module
Implements hook_admin_menu_output_alter().
1 invocation of hook_admin_menu_output_alter()
admin_menu_output in ./admin_menu.module
Build the administration menu output.

File

./admin_menu.api.php, line 43
API documentation for Administration menu.

Code

function hook_admin_menu_output_alter(&$content) {

  // Add new top-level item.
  $content['menu']['myitem'] = array(
    '#title' => t('My item'),
    // #attributes are used for list items (LI). Note the special syntax for
    // the 'class' attribute.
    '#attributes' => array(
      'class' => array(
        'mymodule-myitem',
      ),
    ),
    '#href' => 'mymodule/path',
    // #options are passed to l(). Note that you can apply 'attributes' for
    // links (A) here.
    '#options' => array(
      'query' => drupal_get_destination(),
    ),
    // #weight controls the order of links in the resulting item list.
    '#weight' => 50,
  );

  // Add link to manually run cron.
  $content['menu']['myitem']['cron'] = array(
    '#title' => t('Run cron'),
    '#access' => user_access('administer site configuration'),
    '#href' => 'admin/reports/status/run-cron',
  );
}