You are here

function admin_menu_translate in Administration menu 7.3

Same name and namespace in other branches
  1. 8.3 admin_menu.inc \admin_menu_translate()

Translate an expanded router item into a menu link suitable for rendering.

Parameters

$router_item: A menu router item.

$map: A path map with placeholders replaced.

1 call to admin_menu_translate()
admin_menu_merge_tree in ./admin_menu.inc
Walk through the entire menu tree and merge in expanded dynamic menu links.

File

./admin_menu.inc, line 259
Menu builder functions for Administration menu.

Code

function admin_menu_translate($router_item, $map) {
  _menu_translate($router_item, $map, TRUE);

  // Run through hook_translated_menu_link_alter() to add devel information,
  // if configured.
  $router_item['menu_name'] = 'management';

  // @todo Invoke as usual like _menu_link_translate().
  admin_menu_translated_menu_link_alter($router_item, NULL);
  if ($router_item['access']) {

    // Override mlid to make this item unique; since these items are expanded
    // from dynamic items, the mlid is always the same, so each item would
    // replace any other.
    // @todo Doing this instead leads to plenty of duplicate links below
    //   admin/structure/menu; likely a hidden recursion problem.
    // $router_item['mlid'] = $router_item['href'] . $router_item['mlid'];.
    $router_item['mlid'] = $router_item['href'];

    // Turn menu callbacks into regular menu items to make them visible.
    if ($router_item['type'] == MENU_CALLBACK) {
      $router_item['type'] = MENU_NORMAL_ITEM;
    }

    // @see _menu_tree_check_access()
    $key = 50000 + $router_item['weight'] . ' ' . $router_item['title'] . ' ' . $router_item['mlid'];
    return array(
      $key => array(
        'link' => $router_item,
        'below' => array(),
      ),
    );
  }
  return array();
}