public function BusinessRulesProcessor::isConditionValid in Business Rules 8
Same name and namespace in other branches
- 2.x src/Util/BusinessRulesProcessor.php \Drupal\business_rules\Util\BusinessRulesProcessor::isConditionValid()
Checks if one condition is valid.
Parameters
\Drupal\business_rules\Entity\Condition $condition: The condition.
\Drupal\business_rules\Events\BusinessRulesEvent $event: The event.
Return value
bool True if the condition is valid or False if not.
Throws
\ReflectionException
1 call to BusinessRulesProcessor::isConditionValid()
- BusinessRulesProcessor::processItems in src/
Util/ BusinessRulesProcessor.php - Process the items.
File
- src/
Util/ BusinessRulesProcessor.php, line 507
Class
- BusinessRulesProcessor
- Class BusinessRulesProcessor.
Namespace
Drupal\business_rules\UtilCode
public function isConditionValid(Condition $condition, BusinessRulesEvent $event) {
// Dispatch a event before check if condition is valid.
$this->eventDispatcher
->dispatch('business_rules.before_check_if_condition_is_valid', new Event($event, $condition));
$condition_variables = $condition
->getVariables();
$this
->evaluateVariables($condition_variables, $event);
$result = $condition
->process($event);
$result = $condition
->isReverse() ? !$result : $result;
// Dispatch a event after check if condition is valid.
$this->eventDispatcher
->dispatch('business_rules.after_check_if_condition_is_valid', new Event($event, $condition));
return $result;
}