You are here

public function Condition::process in Business Rules 8

Same name and namespace in other branches
  1. 2.x src/Entity/Condition.php \Drupal\business_rules\Entity\Condition::process()

Process the condition.

Parameters

\Drupal\business_rules\Events\BusinessRulesEvent $event: The event that has triggered the condition.

Return value

bool Boolean value that indicates if the condition is true.

Throws

\ReflectionException

Overrides ConditionInterface::process

File

src/Entity/Condition.php, line 217

Class

Condition
Defines the Condition entity.

Namespace

Drupal\business_rules\Entity

Code

public function process(BusinessRulesEvent $event) {
  $condition_type = $this->itemManager
    ->getDefinition($this
    ->getType());
  $reflection = new \ReflectionClass($condition_type['class']);

  /** @var \Drupal\business_rules\Plugin\BusinessRulesConditionPlugin $defined_condition */
  $defined_condition = $reflection
    ->newInstance($condition_type, $condition_type['id'], $condition_type);
  $condition = Condition::load($this
    ->id());
  $defined_condition
    ->processTokens($condition, $event);
  return $defined_condition
    ->process($condition, $event);
}