You are here

function overlay_drupal_goto_alter in Drupal 7

Implements hook_drupal_goto_alter().

File

modules/overlay/overlay.module, line 255
Displays the Drupal administration interface in an overlay.

Code

function overlay_drupal_goto_alter(&$path, &$options, &$http_response_code) {
  if (overlay_get_mode() == 'child') {

    // The authorize.php script bootstraps Drupal to a very low level, where
    // the PHP code that is necessary to close the overlay properly will not be
    // loaded. Therefore, if we are redirecting to authorize.php inside the
    // overlay, instead redirect back to the current page with instructions to
    // close the overlay there before redirecting to the final destination; see
    // overlay_init().
    if ($path == system_authorized_get_url() || $path == system_authorized_batch_processing_url()) {
      $_SESSION['overlay_close_dialog'] = array(
        $path,
        $options,
      );
      $path = current_path();
      $options = drupal_get_query_parameters();
    }

    // If the current page request is inside the overlay, add ?render=overlay
    // to the new path, so that it appears correctly inside the overlay.
    if (isset($options['query'])) {
      $options['query'] += array(
        'render' => 'overlay',
      );
    }
    else {
      $options['query'] = array(
        'render' => 'overlay',
      );
    }
  }
}