interface EntityTypeManagerInterface

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Entity/EntityTypeManagerInterface.php \Drupal\Core\Entity\EntityTypeManagerInterface
  2. 8.9.x core/lib/Drupal/Core/Entity/EntityTypeManagerInterface.php \Drupal\Core\Entity\EntityTypeManagerInterface
  3. 10 core/lib/Drupal/Core/Entity/EntityTypeManagerInterface.php \Drupal\Core\Entity\EntityTypeManagerInterface

Provides an interface for entity type managers.

Hierarchy

  • interface \Drupal\Component\Plugin\Discovery\CachedDiscoveryInterface extends \Drupal\Component\Plugin\Discovery\DiscoveryInterface; interface \Drupal\Component\Plugin\PluginManagerInterface extends \Drupal\Component\Plugin\Discovery\DiscoveryInterface \Drupal\Component\Plugin\Factory\FactoryInterface \Drupal\Component\Plugin\Mapper\MapperInterface
    • interface \Drupal\Core\Entity\EntityTypeManagerInterface extends \Drupal\Component\Plugin\PluginManagerInterface \Drupal\Component\Plugin\Discovery\CachedDiscoveryInterface

Expanded class hierarchy of EntityTypeManagerInterface

All classes that implement EntityTypeManagerInterface

380 files declare their use of EntityTypeManagerInterface
AddFormBase.php in core/modules/media_library/src/Form/AddFormBase.php
AddModeration.php in core/modules/content_moderation/src/Plugin/ConfigAction/AddModeration.php
AddModerationDeriver.php in core/modules/content_moderation/src/Plugin/ConfigAction/AddModerationDeriver.php
AddToAllBundles.php in core/modules/field/src/Plugin/ConfigAction/AddToAllBundles.php
AddToAllBundlesConfigActionTest.php in core/modules/field/tests/src/Kernel/AddToAllBundlesConfigActionTest.php

... See full list

File

core/lib/Drupal/Core/Entity/EntityTypeManagerInterface.php, line 11

Namespace

Drupal\Core\Entity
View source
interface EntityTypeManagerInterface extends PluginManagerInterface, CachedDiscoveryInterface {
    
    /**
     * Creates a new access control handler instance.
     *
     * @param string $entity_type_id
     *   The entity type ID for this access control handler.
     *
     * @return \Drupal\Core\Entity\EntityAccessControlHandlerInterface
     *   An access control handler instance.
     */
    public function getAccessControlHandler($entity_type_id);
    
    /**
     * Creates a new storage instance.
     *
     * @param string $entity_type_id
     *   The entity type ID for this storage.
     *
     * @return \Drupal\Core\Entity\EntityStorageInterface
     *   A storage instance.
     *
     * @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
     *   Thrown if the entity type doesn't exist.
     * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
     *   Thrown if the storage handler couldn't be loaded.
     */
    public function getStorage($entity_type_id);
    
    /**
     * Creates a new view builder instance.
     *
     * @param string $entity_type_id
     *   The entity type ID for this view builder.
     *
     * @return \Drupal\Core\Entity\EntityViewBuilderInterface
     *   A view builder instance.
     */
    public function getViewBuilder($entity_type_id);
    
    /**
     * Creates a new entity list builder.
     *
     * @param string $entity_type_id
     *   The entity type ID for this list builder.
     *
     * @return \Drupal\Core\Entity\EntityListBuilderInterface
     *   An entity list builder instance.
     */
    public function getListBuilder($entity_type_id);
    
    /**
     * Creates a new form instance.
     *
     * @param string $entity_type_id
     *   The entity type ID for this form.
     * @param string $operation
     *   The name of the operation to use, e.g., 'default'.
     *
     * @return \Drupal\Core\Entity\EntityFormInterface
     *   A form instance.
     */
    public function getFormObject($entity_type_id, $operation);
    
    /**
     * Gets all route provider instances.
     *
     * @param string $entity_type_id
     *   The entity type ID for the route providers.
     *
     * @return \Drupal\Core\Entity\Routing\EntityRouteProviderInterface[]
     */
    public function getRouteProviders($entity_type_id);
    
    /**
     * Checks whether a certain entity type has a certain handler.
     *
     * @param string $entity_type_id
     *   The ID of the entity type.
     * @param string $handler_type
     *   The name of the handler.
     *
     * @return bool
     *   Returns TRUE if the entity type has the handler, else FALSE.
     */
    public function hasHandler($entity_type_id, $handler_type);
    
    /**
     * Returns a handler instance for the given entity type and handler.
     *
     * Entity handlers are instantiated once per entity type and then cached
     * in the entity type manager, and so subsequent calls to getHandler() for
     * a particular entity type and handler type will return the same object.
     * This means that properties on a handler may be used as a static cache,
     * although as the handler is common to all entities of the same type,
     * any data that is per-entity should be keyed by the entity ID.
     *
     * @param string $entity_type_id
     *   The entity type ID for this handler.
     * @param string $handler_type
     *   The handler type to create an instance for.
     *
     * @return object
     *   A handler instance.
     *
     * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
     */
    public function getHandler($entity_type_id, $handler_type);
    
    /**
     * Creates new handler instance.
     *
     * Usually \Drupal\Core\Entity\EntityTypeManagerInterface::getHandler() is
     * preferred since that method has additional checking that the class exists
     * and has static caches.
     *
     * @param mixed $class
     *   The handler class to instantiate.
     * @param \Drupal\Core\Entity\EntityTypeInterface $definition
     *   The entity type definition.
     *
     * @return object
     *   A handler instance.
     */
    public function createHandlerInstance($class, ?EntityTypeInterface $definition = NULL);
    
    /**
     * {@inheritdoc}
     *
     * @return \Drupal\Core\Entity\EntityTypeInterface|null
     */
    public function getDefinition($entity_type_id, $exception_on_invalid = TRUE);
    
    /**
     * {@inheritdoc}
     *
     * @return \Drupal\Core\Entity\EntityTypeInterface[]
     */
    public function getDefinitions();

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
CachedDiscoveryInterface::clearCachedDefinitions public function Clears static and persistent plugin definition caches. 2
CachedDiscoveryInterface::useCaches public function Disable the use of caches. 2
DiscoveryInterface::hasDefinition public function Indicates if a specific plugin definition exists.
EntityTypeManagerInterface::createHandlerInstance public function Creates new handler instance. 1
EntityTypeManagerInterface::getAccessControlHandler public function Creates a new access control handler instance. 1
EntityTypeManagerInterface::getDefinition public function Overrides DiscoveryInterface::getDefinition
EntityTypeManagerInterface::getDefinitions public function Overrides DiscoveryInterface::getDefinitions
EntityTypeManagerInterface::getFormObject public function Creates a new form instance. 1
EntityTypeManagerInterface::getHandler public function Returns a handler instance for the given entity type and handler. 1
EntityTypeManagerInterface::getListBuilder public function Creates a new entity list builder. 1
EntityTypeManagerInterface::getRouteProviders public function Gets all route provider instances. 1
EntityTypeManagerInterface::getStorage public function Creates a new storage instance. 1
EntityTypeManagerInterface::getViewBuilder public function Creates a new view builder instance. 1
EntityTypeManagerInterface::hasHandler public function Checks whether a certain entity type has a certain handler. 1

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.