Projet

Général

Profil

Révision 082b75eb

Ajouté par Assos Assos il y a environ 6 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/cas/cas.module
447 447
 * @see cas_translated_menu_link_alter()
448 448
 */
449 449
function cas_menu_link_alter(&$item) {
450
  if (strtolower($item['link_path']) == 'cas' || strtolower($item['link_path']) == 'caslogout') {
450
  $link_path = strtolower($item['link_path']);
451
  if ($link_path == 'cas' || $link_path == 'caslogout') {
451 452
    $item['options']['alter'] = TRUE;
452 453
  }
453 454
}
......
455 456
/**
456 457
 * Implements hook_translated_menu_item_alter().
457 458
 *
458
 * Append dynamic query 'destination' to several menu items.
459
 * Append dynamic query 'destination' to CAS menu links.
459 460
 */
460 461
function cas_translated_menu_link_alter(&$item) {
461
  if (strtolower($item['href']) == 'cas') {
462
    $item['localized_options']['query'] = drupal_get_destination();
463
  }
464
  elseif (strtolower($item['href']) == 'caslogout' && !variable_get('cas_logout_destination', '')) {
465
    $item['localized_options']['query'] = drupal_get_destination();
462
  $href = strtolower($item['href']);
463
  $append_destination = $href == 'cas' || ($href == 'caslogout' && !variable_get('cas_logout_destination', ''));
464
  if ($append_destination) {
465
    // Don't overwrite existing query params that may exist in the menu link.
466
    if (isset($item['localized_options']['query'])) {
467
      $menu_link_query_params = array_merge(drupal_get_destination(), $item['localized_options']['query']);
468
    }
469
    else {
470
      $menu_link_query_params = drupal_get_destination();
471
    }
472
    $item['localized_options']['query'] = $menu_link_query_params;
466 473
  }
467 474
}
468 475

  

Formats disponibles : Unified diff