function accountmenu_translated_menu_link_alter in Account menu 7
Same name and namespace in other branches
- 6 accountmenu.module \accountmenu_translated_menu_link_alter()
Implements hook_link_alter.
Ensures links that should have destinations do so, and applies our own @name and @realname tokens.
File
- ./
accountmenu.module, line 202 - accountmenu.module Provide a dynamic Log in/My account/Log out account menu
Code
function accountmenu_translated_menu_link_alter(&$item) {
if ($item['module'] != 'accountmenu') {
return;
}
if (_accountmenu_menu_need_destination($item['link_path'])) {
if (_accountmenu_is_404() || arg(0) === 'user') {
// on a 404 page or any 'user' paths, send user to the front
$item['localized_options']['query'] = array(
'destination' => '<front>',
);
}
else {
$item['localized_options']['query'] = drupal_get_destination();
}
// potx will complain here, but line 496 of menu.inc is doing the same so
$item['title'] = t($item['link_title']);
}
}