abstract class DisplayDeriverBase in Search API 8
A base class for display derivers.
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements DeriverInterface
- class \Drupal\search_api\Display\DisplayDeriverBase implements ContainerDeriverInterface uses StringTranslationTrait
Expanded class hierarchy of DisplayDeriverBase
1 file declares its use of DisplayDeriverBase
- ViewsDisplayDeriver.php in src/
Plugin/ search_api/ display/ ViewsDisplayDeriver.php
File
- src/
Display/ DisplayDeriverBase.php, line 14
Namespace
Drupal\search_api\DisplayView source
abstract class DisplayDeriverBase extends DeriverBase implements ContainerDeriverInterface {
use StringTranslationTrait;
/**
* {@inheritdoc}
*/
protected $derivatives = NULL;
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
$deriver = new static();
$entity_type_manager = $container
->get('entity_type.manager');
$deriver
->setEntityTypeManager($entity_type_manager);
$translation = $container
->get('string_translation');
$deriver
->setStringTranslation($translation);
return $deriver;
}
/**
* Retrieves the entity type manager.
*
* @return \Drupal\Core\Entity\EntityTypeManagerInterface
* The entity type manager.
*/
public function getEntityTypeManager() {
return $this->entityTypeManager;
}
/**
* Sets the entity type manager.
*
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The new entity type manager.
*
* @return $this
*/
public function setEntityTypeManager(EntityTypeManagerInterface $entity_type_manager) {
$this->entityTypeManager = $entity_type_manager;
return $this;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
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 |
DisplayDeriverBase:: |
protected | property |
List of derivative definitions. Overrides DeriverBase:: |
|
DisplayDeriverBase:: |
protected | property | The entity type manager. | |
DisplayDeriverBase:: |
public static | function |
Creates a new class instance. Overrides ContainerDeriverInterface:: |
|
DisplayDeriverBase:: |
public | function | Retrieves the entity type manager. | |
DisplayDeriverBase:: |
public | function | Sets the entity type manager. | |
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. |