public function PageRedirect::execute in Business Rules 2.x
Same name and namespace in other branches
- 8 src/Plugin/BusinessRulesAction/PageRedirect.php \Drupal\business_rules\Plugin\BusinessRulesAction\PageRedirect::execute()
Execute the action.
Parameters
\Drupal\business_rules\ActionInterface $action: The configured action.
\Drupal\business_rules\Events\BusinessRulesEvent $event: The event that has triggered the action.
Return value
array The render array to be showed on debug block.
Overrides BusinessRulesActionPlugin::execute
File
- src/
Plugin/ BusinessRulesAction/ PageRedirect.php, line 48
Class
- PageRedirect
- Class PageRedirect.
Namespace
Drupal\business_rules\Plugin\BusinessRulesActionCode
public function execute(ActionInterface $action, BusinessRulesEvent $event) {
$url = $action
->getSettings('url');
$url = $this
->processVariables($url, $event
->getArgument('variables'));
$redirect = new RedirectResponse($url);
$redirect
->send();
$result = [
'#type' => 'markup',
'#markup' => t('Page redirect to: %url.', [
'%url' => $url,
]),
];
return $result;
}