1 actions.inc actions_redirect($redirect)

Redirect the user after an action has been performed.

This function should be called after action_execute() if the $context['redirect'] property has been populated.

Parameters

mixed $redirect: Either an array or path string to which the user should be redirected.

File

core/includes/actions.inc, line 126
This is the actions engine for executing stored actions.

Code

function actions_redirect($redirect) {
  if (!is_array($redirect)) {
    $redirect = array($redirect, array());
  }

  // Remove any existing destinations and tack it to the return URL if needed.
  if (isset($_GET['destination'])) {
    $redirect[1]['query']['destination'] = $_GET['destination'];
    unset($_GET['destination']);
  }
  else {
    $redirect[1]['query']['destination'] = $_GET['q'];
  }

  // See backdrop_redirect_form().
  call_user_func_array('backdrop_goto', $redirect);
}