function hook_admin_menu_output_build

nittany7 admin_menu.api.php hook_admin_menu_output_build(&$content)
cis7 admin_menu.api.php hook_admin_menu_output_build(&$content)
mooc7 admin_menu.api.php hook_admin_menu_output_build(&$content)

Add to the administration menu content before it is rendered.

Only use this hook to add new data to the menu structure. Use hook_admin_menu_output_alter() to *alter* existing data.

Parameters

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

  • menu: The administrative menu of links below the path 'admin/*'.
  • icon: The icon menu.
  • account: The user account name and log out link.
  • users: The user counter.

Additionally, these special properties:

  • #components: The actual components contained in $content are configurable and depend on the 'admin_menu_components' configuration value. #components holds a copy of that for convenience.
  • #complete: A Boolean indicating whether the complete menu should be built, ignoring the current configuration in #components.

Passed by reference.

See also

hook_admin_menu_output_alter()

admin_menu_links_menu()

admin_menu_links_icon()

admin_menu_links_user()

theme_admin_menu_links()

2 functions implement hook_admin_menu_output_build()

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

admin_menu_admin_menu_output_build in modules/contrib/admin_menu/admin_menu.module
Implements hook_admin_menu_output_build().
admin_menu_toolbar_admin_menu_output_build in modules/contrib/admin_menu/admin_menu_toolbar/admin_menu_toolbar.module
Implements hook_admin_menu_output_build().
1 invocation of hook_admin_menu_output_build()
admin_menu_output in modules/contrib/admin_menu/admin_menu.module
Build the administration menu output.

File

modules/contrib/admin_menu/admin_menu.api.php, line 67
API documentation for Administration menu.

Code

function hook_admin_menu_output_build(&$content) {
  // In case your implementation provides a configurable component, check
  // whether the component should be displayed:
  if (empty($content['#components']['shortcut.links']) && !$content['#complete']) {
    return;
  }

  // Add new top-level item to the menu.
  if (isset($content['menu'])) {
    $content['menu']['myitem'] = array(
      '#title' => t('My item'),
      
      // #attributes are used for list items (LI).
      '#attributes' => array('class' => array('mymodule-myitem')),
      '#href' => 'mymodule/path',
      
      // #options are passed to l().
      '#options' => array(
        'query' => drupal_get_destination(),
        
        // Apply a class on the link (anchor).
        'attributes' => array('class' => array('myitem-link-anchor')),
      ),
      
      // #weight controls the order of links in the resulting item list.
      '#weight' => 50,
    );
  }
  // Add link to the icon menu to manually run cron.
  if (isset($content['icon'])) {
    $content['icon']['myitem']['cron'] = array(
      '#title' => t('Run cron'),
      '#access' => user_access('administer site configuration'),
      '#href' => 'admin/reports/status/run-cron',
    );
  }
}