You are here

function devel_translated_menu_link_alter in Devel 7

Same name and namespace in other branches
  1. 6 devel.module \devel_translated_menu_link_alter()

Implements hook_translated_menu_item_alter().

Append dynamic querystring 'destination' or 'token' (csfr protection) to several of our own menu items.

File

./devel.module, line 393
This module holds functions useful for Drupal development.

Code

function devel_translated_menu_link_alter(&$item) {
  $need_destination = in_array($item['href'], devel_menu_need_destination());
  $token_protection = devel_menu_need_token_protection();
  $need_token = array_key_exists($item['href'], $token_protection);
  if ($need_destination || $need_token) {
    if ($need_destination) {
      $item['localized_options']['query'] = drupal_get_destination();
    }
    if ($need_token) {
      $item['localized_options']['query']['token'] = drupal_get_token($token_protection[$item['href']]);
    }
  }
  elseif ($item['href'] == 'devel/menu/item') {
    $item['localized_options']['query'] = array(
      'path' => $_GET['q'],
    );
  }
}