_menu_link_map_translate

Definition

_menu_link_map_translate(&$map, $to_arg_functions)
drupal/includes/menu.inc, line 647

Description

This function translates the path elements in the map using any to_arg helper function. These functions take an argument and return an object. See http://drupal.org/node/109153 for more information.

Parameters

map An array of path arguments (ex: array('node', '5'))

$to_arg_functions An array of helper function (ex: array(2 => 'menu_tail_to_arg'))

Related topics

Namesort iconDescription
Menu systemDefine the navigation menus, and route page requests to code based on URLs.

Code

function _menu_link_map_translate(&$map, $to_arg_functions) {
  if ($to_arg_functions) {
    $to_arg_functions = unserialize($to_arg_functions);
    foreach ($to_arg_functions as $index => $function) {
      // Translate place-holders into real values.
      $arg = $function(!empty($map[$index]) ? $map[$index] : '', $map, $index);
      if (!empty($map[$index]) || isset($arg)) {
        $map[$index] = $arg;
      }
      else {
        unset($map[$index]);
      }
    }
  }
}