function _power_menu_translate_menu_link_titles in Power Menu 7.2
Translate the menu link titles.
Parameters
$parents: An array of titles to translate
$language: The language
Return value
array The array with the translated titles
1 call to _power_menu_translate_menu_link_titles()
- power_menu_tokens in ./
power_menu.tokens.inc - Implements hook_tokens().
File
- ./
power_menu.tokens.inc, line 167 - Builds placeholder replacement tokens for power_menu.
Code
function _power_menu_translate_menu_link_titles($parents, $language) {
// When the i18n menu translation function exists, use it in case that the token functions do not allow a
// language parameter. When the i18n sync is enabled all related nodes (translations) of the saved node are
// also updated (when token is used for path auto patterns). In this case it is important, that we get the title
// in the proper language and not the current language of the page request.
if (function_exists('_i18n_menu_link_title')) {
$parents_translated = array();
foreach ($parents as $key => $parent) {
$menu_link = menu_link_load($key);
$parents_translated[$key] = _i18n_menu_link_title($menu_link, $language);
}
return $parents_translated;
}
}