Same name and namespace in other branches
- 8.x-1.x src/Services/EntityCloneServiceProvider.php \Drupal\entity_clone\Services\EntityCloneServiceProvider::entityTypeHasOwnerTrait()
Checks if the given entity implements has owner trait.
Parameters
\Drupal\Core\Entity\EntityTypeInterface $entityType: Entity to be tested.
Return value
bool Returns boolean for the owner trait test.
File
-
src/
Services/ EntityCloneServiceProvider.php, line 34
Class
- 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()));
}