function EntityIsOfType::doEvaluate
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 45
Class
- EntityIsOfType
- Provides an 'Entity is of type' condition.
Namespace
Drupal\rules\Plugin\ConditionCode
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;
}