class EntityDeriverBase

Same name in other branches
  1. 4.0.x src/Plugin/Deriver/EntityDeriverBase.php \Drupal\ctools\Plugin\Deriver\EntityDeriverBase

An abstract base class that sets up the needs of entity specific derivers.

Hierarchy

Expanded class hierarchy of EntityDeriverBase

1 file declares its use of EntityDeriverBase
EntityFieldDeriver.php in modules/ctools_block/src/Plugin/Deriver/EntityFieldDeriver.php

File

src/Plugin/Deriver/EntityDeriverBase.php, line 17

Namespace

Drupal\ctools\Plugin\Deriver
View source
abstract class EntityDeriverBase extends DeriverBase implements ContainerDeriverInterface {
    use StringTranslationTrait;
    
    /**
     * The entity type manager.
     *
     * @var \Drupal\Core\Entity\EntityTypeManagerInterface
     */
    protected $entityTypeManager;
    
    /**
     * The entity field manager.
     *
     * @var \Drupal\Core\Entity\EntityFieldManagerInterface
     */
    protected $entityFieldManager;
    
    /**
     * The entity type repository.
     *
     * @var \Drupal\Core\Entity\EntityTypeRepositoryInterface
     */
    protected $entityTypeRepository;
    
    /**
     * Constructs new EntityViewDeriver.
     *
     * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
     *   The entity type manager.
     * @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation
     *   The string translation service.
     * @param \Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager
     *   The entity field manager.
     * @param \Drupal\Core\Entity\EntityTypeRepositoryInterface $entity_type_repository
     *   The entity type repository.
     */
    public function __construct(EntityTypeManagerInterface $entity_type_manager, TranslationInterface $string_translation, EntityFieldManagerInterface $entity_field_manager, EntityTypeRepositoryInterface $entity_type_repository) {
        $this->entityTypeManager = $entity_type_manager;
        $this->stringTranslation = $string_translation;
        $this->entityFieldManager = $entity_field_manager;
        $this->entityTypeRepository = $entity_type_repository;
    }
    
    /**
     * {@inheritdoc}
     */
    public static function create(ContainerInterface $container, $base_plugin_id) {
        return new static($container->get('entity_type.manager'), $container->get('string_translation'), $container->get('entity_field.manager'), $container->get('entity_type.repository'));
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
DeriverBase::$derivatives protected property List of derivative definitions. 1
DeriverBase::getDerivativeDefinition public function Gets the definition of a derivative plugin. Overrides DeriverInterface::getDerivativeDefinition
DeriverBase::getDerivativeDefinitions public function Gets the definition of all derivatives of a base plugin. Overrides DeriverInterface::getDerivativeDefinitions 41
EntityDeriverBase::$entityFieldManager protected property The entity field manager.
EntityDeriverBase::$entityTypeManager protected property The entity type manager.
EntityDeriverBase::$entityTypeRepository protected property The entity type repository.
EntityDeriverBase::create public static function Creates a new class instance. Overrides ContainerDeriverInterface::create
EntityDeriverBase::__construct public function Constructs new EntityViewDeriver.
StringTranslationTrait::$stringTranslation protected property The string translation service. 3
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.