protected function SystemPageRedirect::doExecute in Rules 8.3
Redirect to a provided url at the end of the request.
Parameters
string $url: Redirect destination url.
File
- src/
Plugin/ RulesAction/ SystemPageRedirect.php, line 93
Class
- SystemPageRedirect
- Provides "Page redirect" rules action.
Namespace
Drupal\rules\Plugin\RulesActionCode
protected function doExecute($url) {
$current_path = $this->currentPathStack
->getPath();
$is_rules_admin_page = strpos($current_path, 'admin/config/workflow/rules') !== FALSE;
// Make sure we do not redirect away from the rules admin pages.
if ($is_rules_admin_page) {
$this->logger
->warning('Skipped page redirect on a rules admin page.');
return;
}
// Make sure we do not redirect during batch processing.
$batch = batch_get();
if (isset($batch['current_set'])) {
$this->logger
->warning('Skipped page redirect during batch processing.');
return;
}
$this->request->attributes
->set('_rules_redirect_action_url', $url);
}