Checks if the given entity implements has owner trait.
Paramètres
\Drupal\Core\Entity\EntityTypeInterface $entityType: Entity to be tested.
Return value
bool Returns boolean for the owner trait test.
Fichier
-
src/
Services/ EntityCloneServiceProvider.php, line 34
Classe
- EntityCloneServiceProvider
- Service Provider Class.
Namespace
Drupal\entity_clone\ServicesCode
public function entityTypeHasOwnerTrait(EntityTypeInterface $entityType) {
try {
$reflectionClass = new \ReflectionClass($entityType->getOriginalClass());
} catch (\ReflectionException $e) {
return FALSE;
}
return in_array(EntityOwnerTrait::class, array_keys($reflectionClass->getTraits()));
}