public function BusinessRulesProcessor::process in Business Rules 8
Same name and namespace in other branches
- 2.x src/Util/BusinessRulesProcessor.php \Drupal\business_rules\Util\BusinessRulesProcessor::process()
Process rules.
Parameters
\Drupal\business_rules\Events\BusinessRulesEvent $event: The event.
File
- src/
Util/ BusinessRulesProcessor.php, line 156
Class
- BusinessRulesProcessor
- Class BusinessRulesProcessor.
Namespace
Drupal\business_rules\UtilCode
public function process(BusinessRulesEvent $event) {
// Check if it's running in safe mode.
if ($this->config
->get('enable_safemode') == TRUE && $this->util->request
->get('brmode') == 'safe' || is_null($this->config
->get('enable_safemode')) && $this->util->request
->get('brmode') == 'safe') {
return;
}
if ($this
->avoidInfiniteLoop($event)) {
return;
}
// Dispatch a event before start the processing.
$this->eventDispatcher
->dispatch('business_rules.before_process_event', $event);
if (!$event
->hasArgument('variables')) {
$event
->setArgument('variables', new VariablesSet());
}
$reacts_on_definition = $event
->getArgument('reacts_on');
$trigger = $reacts_on_definition['id'];
$triggered_rules = $this
->getTriggeredRules($event, $trigger);
$this
->processTriggeredRules($triggered_rules, $event);
$this
->saveDebugInfo();
// Dispatch a event after processing the business rule.
$this->eventDispatcher
->dispatch('business_rules.after_process_event', $event);
}