You are here

public function OrderItemPurchasedEntity::evaluate in Commerce Core 8.2

Evaluates the condition.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity.

Return value

bool TRUE if the condition has been met, FALSE otherwise.

Overrides ConditionInterface::evaluate

File

modules/order/src/Plugin/Commerce/Condition/OrderItemPurchasedEntity.php, line 26

Class

OrderItemPurchasedEntity
Provides the variation condition for order items.

Namespace

Drupal\commerce_order\Plugin\Commerce\Condition

Code

public function evaluate(EntityInterface $entity) {
  $this
    ->assertEntity($entity);
  assert($entity instanceof OrderItemInterface);
  return $this
    ->isValid($entity
    ->getPurchasedEntity());
}