You are here

function admin_menu_translated_menu_link_alter in Administration menu 6.3

Same name and namespace in other branches
  1. 8.3 admin_menu.module \admin_menu_translated_menu_link_alter()
  2. 6 admin_menu.module \admin_menu_translated_menu_link_alter()
  3. 7.3 admin_menu.module \admin_menu_translated_menu_link_alter()

Implements hook_translated_menu_link_alter().

Here is where we make changes to links that need dynamic information such as the current page path or the number of users.

File

./admin_menu.module, line 714
Render an administrative menu as a dropdown menu at the top of the window.

Code

function admin_menu_translated_menu_link_alter(&$item, $map) {
  global $user, $base_url;
  static $access_all;
  if ($item['menu_name'] != 'admin_menu') {
    return;
  }

  // Check whether additional development output is enabled.
  if (!isset($access_all)) {
    $access_all = variable_get('admin_menu_show_all', 0) && module_exists('devel');
  }

  // Prepare links that would not be displayed normally.
  if ($access_all && !$item['access']) {
    $item['access'] = TRUE;

    // Prepare for http://drupal.org/node/266596
    if (!isset($item['localized_options'])) {
      _menu_item_localize($item, $map, TRUE);
    }
  }

  // Don't waste cycles altering items that are not visible
  if (!$item['access']) {
    return;
  }

  // Add developer information to all links, if enabled.
  if ($extra = variable_get('admin_menu_display', 0)) {
    $item['title'] .= ' ' . $extra[0] . ': ' . $item[$extra];
  }
}