You are here

public function EntityBundleBase::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

src/Plugin/Commerce/Condition/EntityBundleBase.php, line 99

Class

EntityBundleBase
Provides the base class for entity bundle conditions.

Namespace

Drupal\commerce\Plugin\Commerce\Condition

Code

public function evaluate(EntityInterface $entity) {
  $this
    ->assertEntity($entity);
  return in_array($entity
    ->bundle(), $this->configuration['bundles']);
}