You are here

public function Email::getConditions in Commerce Email 8

Gets the email conditions.

Return value

\Drupal\commerce\Plugin\Commerce\Condition\ConditionInterface[] The email conditions.

Overrides EmailInterface::getConditions

1 call to Email::getConditions()
Email::applies in src/Entity/Email.php
Checks whether the email applies to the given entity.

File

src/Entity/Email.php, line 289

Class

Email
Defines the email entity class.

Namespace

Drupal\commerce_email\Entity

Code

public function getConditions() {
  $plugin_manager = \Drupal::service('plugin.manager.commerce_condition');
  $conditions = [];
  foreach ($this->conditions as $condition) {
    $condition = $plugin_manager
      ->createInstance($condition['plugin'], $condition['configuration']);
    if ($condition instanceof ParentEntityAwareInterface) {
      $condition
        ->setParentEntity($this);
    }
    $conditions[] = $condition;
  }
  return $conditions;
}