public function Email::applies in Commerce Email 8
Checks whether the email applies to the given entity.
Ensures that the conditions pass.
Parameters
\Drupal\Core\Entity\ContentEntityInterface $entity: The entity.
Return value
bool TRUE if email applies, FALSE otherwise.
Overrides EmailInterface::applies
File
- src/
Entity/ Email.php, line 320
Class
- Defines the email entity class.
Namespace
Drupal\commerce_email\EntityCode
public function applies(ContentEntityInterface $entity) {
$conditions = $this
->getConditions();
if (!$conditions) {
// Emails without conditions always apply.
return TRUE;
}
$condition_group = new ConditionGroup($conditions, $this
->getConditionOperator());
return $condition_group
->evaluate($entity);
}