protected function EntityIsOfBundle::doEvaluate in Rules 8.3
Check if a provided entity is of a specific type and bundle.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity to check the bundle and type of.
string $type: The type to check for.
string $bundle: The bundle to check for.
Return value
bool TRUE if the provided entity is of the provided type and bundle.
File
- src/
Plugin/ Condition/ EntityIsOfBundle.php, line 51
Class
- EntityIsOfBundle
- Provides an 'Entity is of bundle' condition.
Namespace
Drupal\rules\Plugin\ConditionCode
protected function doEvaluate(EntityInterface $entity, $type, $bundle) {
$entity_type = $entity
->getEntityTypeId();
$entity_bundle = $entity
->bundle();
// Check to see whether the entity's bundle and type match the specified
// values.
return $entity_bundle == $bundle && $entity_type == $type;
}