You are here

function masquerade_translated_menu_link_alter in Masquerade 6

Same name and namespace in other branches
  1. 7 masquerade.module \masquerade_translated_menu_link_alter()

Implementation of hook_translated_menu_link_alter().

Dynamically add the CSRF protection token to the Masquerade menu items.

File

./masquerade.module, line 153
masquerade.module

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');
    }
  }
}