You are here

public function Rule::getConditions in RNG - Events and Registrations 8

Same name and namespace in other branches
  1. 8.2 src/Entity/Rule.php \Drupal\rng\Entity\Rule::getConditions()
  2. 3.x src/Entity/Rule.php \Drupal\rng\Entity\Rule::getConditions()

Get conditions for the rule.

Return value

\Drupal\rng\RuleComponentInterface[] An array of action entities.

Overrides RuleInterface::getConditions

1 call to Rule::getConditions()
Rule::evaluateConditions in src/Entity/Rule.php
Evaluates all conditions on the rule.

File

src/Entity/Rule.php, line 78

Class

Rule
Defines the event rule entity.

Namespace

Drupal\rng\Entity

Code

public function getConditions() {
  $ids = \Drupal::entityQuery('rng_rule_component')
    ->condition('rule', $this
    ->id(), '=')
    ->condition('type', 'condition', '=')
    ->execute();
  return array_merge($ids ? RuleComponent::loadMultiple($ids) : [], array_filter($this->components_unsaved, function ($component) {
    return $component
      ->getType() == 'condition';
  }));
}