abstract class EntityDeriverBase in Chaos Tool Suite (ctools) 8.3
An abstract base class that sets up the needs of entity specific derivers.
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements DeriverInterface
- class \Drupal\ctools\Plugin\Deriver\EntityDeriverBase implements ContainerDeriverInterface uses StringTranslationTrait
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\DeriverView 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DeriverBase:: |
protected | property | List of derivative definitions. | 1 |
DeriverBase:: |
public | function |
Gets the definition of a derivative plugin. Overrides DeriverInterface:: |
|
DeriverBase:: |
public | function |
Gets the definition of all derivatives of a base plugin. Overrides DeriverInterface:: |
39 |
EntityDeriverBase:: |
protected | property | The entity field manager. | |
EntityDeriverBase:: |
protected | property | The entity type manager. | |
EntityDeriverBase:: |
protected | property | The entity type repository. | |
EntityDeriverBase:: |
public static | function |
Creates a new class instance. Overrides ContainerDeriverInterface:: |
|
EntityDeriverBase:: |
public | function | Constructs new EntityViewDeriver. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |