Same name in other branches
- 2.x src/Services/EntityCloneServiceProvider.php \Drupal\entity_clone\Services\EntityCloneServiceProvider
Service Provider Class.
Hierarchy
- class \Drupal\entity_clone\Services\EntityCloneServiceProvider
Expanded class hierarchy of EntityCloneServiceProvider
2 files declare their use of EntityCloneServiceProvider
- EntityCloneForm.php dans src/
Form/ EntityCloneForm.php - EntityClonePermissions.php dans src/
EntityClonePermissions.php
1 string reference to 'EntityCloneServiceProvider'
1 service uses EntityCloneServiceProvider
Fichier
-
src/
Services/ EntityCloneServiceProvider.php, line 11
Namespace
Drupal\entity_clone\ServicesView source
class EntityCloneServiceProvider {
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeInterface
*/
protected $entityType;
/**
* Constructs a new ServiceProvider object.
*/
public function __construct() {
}
/**
* Checks if the given entity implements has owner trait.
*
* @param \Drupal\Core\Entity\EntityTypeInterface $entityType
* Entity to be tested.
*
* @return bool
* Returns boolean for the owner trait test.
*/
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()));
}
}
Members
Titre Trier par ordre décroissant | Modifiers | Object type | Résumé |
---|---|---|---|
EntityCloneServiceProvider::$entityType | protected | property | The entity type manager. |
EntityCloneServiceProvider::entityTypeHasOwnerTrait | public | function | Checks if the given entity implements has owner trait. |
EntityCloneServiceProvider::__construct | public | function | Constructs a new ServiceProvider object. |