public function EntityTypeManager::getHandler in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Entity/EntityTypeManager.php \Drupal\Core\Entity\EntityTypeManager::getHandler()
Creates a new handler instance for a entity type and handler type.
Parameters
string $entity_type: The entity type for this handler.
string $handler_type: The handler type to create an instance for.
Return value
object A handler instance.
Throws
\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
Overrides EntityTypeManagerInterface::getHandler
4 calls to EntityTypeManager::getHandler()
- EntityTypeManager::getAccessControlHandler in core/
lib/ Drupal/ Core/ Entity/ EntityTypeManager.php - Creates a new access control handler instance.
- EntityTypeManager::getListBuilder in core/
lib/ Drupal/ Core/ Entity/ EntityTypeManager.php - Creates a new entity list builder.
- EntityTypeManager::getStorage in core/
lib/ Drupal/ Core/ Entity/ EntityTypeManager.php - Creates a new storage instance.
- EntityTypeManager::getViewBuilder in core/
lib/ Drupal/ Core/ Entity/ EntityTypeManager.php - Creates a new view builder instance.
File
- core/
lib/ Drupal/ Core/ Entity/ EntityTypeManager.php, line 233 - Contains \Drupal\Core\Entity\EntityTypeManager.
Class
- EntityTypeManager
- Manages entity type plugin definitions.
Namespace
Drupal\Core\EntityCode
public function getHandler($entity_type, $handler_type) {
if (!isset($this->handlers[$handler_type][$entity_type])) {
$definition = $this
->getDefinition($entity_type);
$class = $definition
->getHandlerClass($handler_type);
if (!$class) {
throw new InvalidPluginDefinitionException($entity_type, sprintf('The "%s" entity type did not specify a %s handler.', $entity_type, $handler_type));
}
$this->handlers[$handler_type][$entity_type] = $this
->createHandlerInstance($class, $definition);
}
return $this->handlers[$handler_type][$entity_type];
}