You are here

function me_views_pre_execute in me aliases 8

Same name and namespace in other branches
  1. 6.2 includes/me.views.inc \me_views_pre_execute()
  2. 6 includes/me.views.inc \me_views_pre_execute()
  3. 7 includes/views/me.views.inc \me_views_pre_execute()

Implementation of Views' hook_views_pre_execute().

See http://drupal.org/project/views for module and hook information.

1 call to me_views_pre_execute()
me_plugin_argument_validate_me_alias::validate_argument in includes/views/handlers/me_plugin_argument_validate_me_alias.inc
Performs the actual validation.

File

includes/views/me.views.inc, line 29
Provides views intergration for the me module.

Code

function me_views_pre_execute($view, $do_redirect = FALSE) {
  static $redirect = FALSE;

  // If $view is NULL, then we are setting the redirect.
  if (is_null($view)) {
    $redirect = $do_redirect;
  }
  elseif (!empty($redirect)) {

    // We should always be able to redirect here regardless, as our handler has to
    // have run for our option to be set, which means we need to redirect anyway.
    // Loop over the argument handlers to get the arguments we need. We also keep this
    // consistent with any extra arguments that may have been passed in.
    $arguments = $view->args;
    foreach (array_values($view->argument) as $key => $argument) {
      if (isset($argument->argument)) {
        $arguments[$key] = $argument->argument;
      }
    }

    // Redirect to the path.
    drupal_goto($view
      ->get_url($arguments));
  }
}