You are here

public function Condition::process in Business Rules 2.x

Same name and namespace in other branches
  1. 8 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 241

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);
}