You are here

protected function EntityIsOfType::doEvaluate in Rules 8.3

Check if the provided entity is of a specific type.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity to check for a type.

string $type: The type to check for.

Return value

bool TRUE if the entity is of the provided type.

File

src/Plugin/Condition/EntityIsOfType.php, line 44

Class

EntityIsOfType
Provides an 'Entity is of type' condition.

Namespace

Drupal\rules\Plugin\Condition

Code

protected function doEvaluate(EntityInterface $entity, $type) {
  $entity_type = $entity
    ->getEntityTypeId();

  // Check to see whether the entity's type matches the specified value.
  return $entity_type == $type;
}