function masquerade_translated_menu_link_alter in Masquerade 7
Same name and namespace in other branches
- 6 masquerade.module \masquerade_translated_menu_link_alter()
Implements hook_translated_menu_link_alter().
Dynamically add the CSRF protection token to the Masquerade menu items.
File
- ./
masquerade.module, line 181 - The masquerade module allows administrators to masquerade as other user.
Code
function masquerade_translated_menu_link_alter(&$item, $map) {
if (isset($item['page_callback'])) {
if ($item['page_callback'] == 'masquerade_switch_user_page' && isset($map[2])) {
$item['localized_options']['query']['token'] = drupal_get_token('masquerade/switch/' . $map[2]);
}
elseif ($item['page_callback'] == 'masquerade_switch_back_page') {
$item['localized_options']['query']['token'] = drupal_get_token('masquerade/unswitch');
}
}
}