function _menu_translate

×

Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
cis7 menu.inc _menu_translate(&$router_item, $map, $to_arg = FALSE)
cle7 menu.inc _menu_translate(&$router_item, $map, $to_arg = FALSE)
elmsmedia7 menu.inc _menu_translate(&$router_item, $map, $to_arg = FALSE)
icor7 menu.inc _menu_translate(&$router_item, $map, $to_arg = FALSE)
meedjum_blog7 menu.inc _menu_translate(&$router_item, $map, $to_arg = FALSE)
mooc7 menu.inc _menu_translate(&$router_item, $map, $to_arg = FALSE)

Handles dynamic path translation and menu access control.

When a user arrives on a page such as node/5, this function determines what "5" corresponds to, by inspecting the page's menu path definition, node/%node. This will call node_load(5) to load the corresponding node object.

It also works in reverse, to allow the display of tabs and menu items which contain these dynamic arguments, translating node/%node to node/5.

Translation of menu item titles and descriptions are done here to allow for storage of English strings in the database, and translation to the language required to generate the current page.

Parameters

$router_item: A menu router item

$map: An array of path arguments; for example, array('node', '5').

$to_arg: Execute $item['to_arg_functions'] or not. Use only if you want to render a path from the menu table, for example tabs.

Return value

Returns the map with objects loaded as defined in the $item['load_functions']. $item['access'] becomes TRUE if the item is accessible, FALSE otherwise. $item['href'] is set according to the map. If an error occurs during calling the load_functions (like trying to load a non-existent node) then this function returns FALSE.

Related topics

5 calls to _menu_translate()
admin_menu_translate in sites/all/modules/ulmus/admin_menu/admin_menu.inc
Translate an expanded router item into a menu link suitable for rendering.
menu_contextual_links in includes/menu.inc
Retrieves contextual links for a path based on registered local tasks.
menu_get_item in includes/menu.inc
Gets a router item.
menu_link_get_preferred in includes/menu.inc
Looks up the preferred menu link for a given system path.
menu_local_tasks in includes/menu.inc
Collects the local tasks (tabs), action links, and the root path.

File

includes/menu.inc, line 753
API for the Drupal menu system.

Code

function _menu_translate(&$router_item, $map, $to_arg = FALSE) {
  if ($to_arg && !empty($router_item['to_arg_functions'])) {
    // Fill in missing path elements, such as the current uid.
    _menu_link_map_translate($map, $router_item['to_arg_functions']);
  }
  // The $path_map saves the pieces of the path as strings, while elements in
  // $map may be replaced with loaded objects.
  $path_map = $map;
  if (!empty($router_item['load_functions']) && !_menu_load_objects($router_item, $map)) {
    // An error occurred loading an object.
    $router_item['access'] = FALSE;
    return FALSE;
  }

  // Generate the link path for the page request or local tasks.
  $link_map = explode('/', $router_item['path']);
  if (isset($router_item['tab_root'])) {
    $tab_root_map = explode('/', $router_item['tab_root']);
  }
  if (isset($router_item['tab_parent'])) {
    $tab_parent_map = explode('/', $router_item['tab_parent']);
  }
  for ($i = 0; $i < $router_item['number_parts']; $i++) {
    if ($link_map[$i] == '%') {
      $link_map[$i] = $path_map[$i];
    }
    if (isset($tab_root_map[$i]) && $tab_root_map[$i] == '%') {
      $tab_root_map[$i] = $path_map[$i];
    }
    if (isset($tab_parent_map[$i]) && $tab_parent_map[$i] == '%') {
      $tab_parent_map[$i] = $path_map[$i];
    }
  }
  $router_item['href'] = implode('/', $link_map);
  $router_item['tab_root_href'] = implode('/', $tab_root_map);
  $router_item['tab_parent_href'] = implode('/', $tab_parent_map);
  $router_item['options'] = array();
  _menu_check_access($router_item, $map);

  // For performance, don't localize an item the user can't access.
  if ($router_item['access']) {
    _menu_item_localize($router_item, $map);
  }

  return $map;
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.