public function ConsentUserResolverPluginManager::getForEntityType in General Data Protection Regulation 8
Same name and namespace in other branches
- 8.2 modules/gdpr_consent/src/ConsentUserResolver/ConsentUserResolverPluginManager.php \Drupal\gdpr_consent\ConsentUserResolver\ConsentUserResolverPluginManager::getForEntityType()
- 3.0.x modules/gdpr_consent/src/ConsentUserResolver/ConsentUserResolverPluginManager.php \Drupal\gdpr_consent\ConsentUserResolver\ConsentUserResolverPluginManager::getForEntityType()
Finds a resolver for the specified entity type/bundle.
Parameters
string $entityType: The entity type.
string $bundle: The bundle.
Return value
\Drupal\gdpr_consent\ConsentUserResolver\GdprConsentUserResolverInterface The resolver that will be used to find the User for a specific entity.
Throws
\Exception
File
- modules/
gdpr_consent/ src/ ConsentUserResolver/ ConsentUserResolverPluginManager.php, line 115
Class
- ConsentUserResolverPluginManager
- Class ConsentUserResolverPluginManager.
Namespace
Drupal\gdpr_consent\ConsentUserResolverCode
public function getForEntityType($entityType, $bundle) {
$definition = $this
->getDefinitionForType($entityType, $bundle);
if (FALSE === $definition) {
throw new \Exception("Could not determine user ID for entity type {$entityType}. Please ensure there is a resolver registered.");
}
return $this
->createInstance($definition['id']);
}