You are here

function devel_drupal_goto_alter in Devel 7

Implements hook_drupal_goto_alter().

File

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

Code

function devel_drupal_goto_alter($path, $options, $http_response_code) {
  global $user;
  if (isset($path) && !devel_silent()) {

    // The page we are leaving is a drupal_goto(). Present a redirection page
    // so that the developer can see the intermediate query log.
    // We don't want to load user module here, so keep function_exists() call.
    if (isset($user) && function_exists('user_access') && user_access('access devel information') && variable_get('devel_redirect_page', 0)) {
      $destination = function_exists('url') ? url($path, $options) : $path;
      $output = t_safe('<p>The user is being redirected to <a href="@destination">@destination</a>.</p>', array(
        '@destination' => $destination,
      ));
      drupal_deliver_page($output);

      // Don't allow the automatic redirect to happen.
      exit;
    }
    else {
      $GLOBALS['devel_redirecting'] = TRUE;
    }
  }
}