public EntityTypeManager::getHandler($entity_type, $handler_type)
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
File
- core/lib/Drupal/Core/Entity/EntityTypeManager.php, line 231
Class
- EntityTypeManager
- Manages entity type plugin definitions.
Namespace
Drupal\Core\Entity
Code
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]; }
Please login to continue.