function _token_menu_link_translate in Token 6
Same name and namespace in other branches
- 7 token.module \_token_menu_link_translate()
2 calls to _token_menu_link_translate()
- token_book_link_load in ./
token.module - Get a translated book menu link by its mlid, without access checking.
- token_menu_link_load in ./
token.module - Get a translated menu link by its mlid, without access checking.
File
- ./
token.module, line 890 - The Token API module.
Code
function _token_menu_link_translate(&$item) {
$map = array();
if (!is_array($item['options'])) {
$item['options'] = unserialize($item['options']);
}
if ($item['external']) {
$item['access'] = 1;
$item['href'] = $item['link_path'];
$item['title'] = $item['link_title'];
$item['localized_options'] = $item['options'];
}
else {
$map = explode('/', $item['link_path']);
_menu_link_map_translate($map, $item['to_arg_functions']);
$item['href'] = implode('/', $map);
// Note - skip callbacks without real values for their arguments.
if (strpos($item['href'], '%') !== FALSE) {
$item['access'] = FALSE;
return FALSE;
}
$item['access'] = TRUE;
_menu_item_localize($item, $map, TRUE);
}
// Allow other customizations - e.g. adding a page-specific query string to the
// options array. For performance reasons we only invoke this hook if the link
// has the 'alter' flag set in the options array.
if (!empty($item['options']['alter'])) {
drupal_alter('translated_menu_link', $item, $map);
}
return $map;
}