You are here

function admin_menu_translated_menu_link_alter in Administration menu 8.3

Same name and namespace in other branches
  1. 6.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.

1 call to admin_menu_translated_menu_link_alter()
admin_menu_translate in ./admin_menu.inc
Translate an expanded router item into a menu link suitable for rendering.

File

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

Code

function admin_menu_translated_menu_link_alter(&$item, $map) {
  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];
  }
}