class DigestDeriver in Message Digest 8
Derive message digest plugins for various intervals.
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements DeriverInterface
- class \Drupal\message_digest\Plugin\Deriver\DigestDeriver implements ContainerDeriverInterface uses StringTranslationTrait
Expanded class hierarchy of DigestDeriver
File
- src/
Plugin/ Deriver/ DigestDeriver.php, line 14
Namespace
Drupal\message_digest\Plugin\DeriverView source
class DigestDeriver extends DeriverBase implements ContainerDeriverInterface {
use StringTranslationTrait;
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* DigestDeriver constructor.
*
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
*/
public function __construct(EntityTypeManagerInterface $entity_type_manager) {
$this->entityTypeManager = $entity_type_manager;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static($container
->get('entity_type.manager'));
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
$this->derivatives = [];
foreach ($this->entityTypeManager
->getStorage('message_digest_interval')
->loadMultiple() as $id => $interval) {
/** @var \Drupal\message_digest\Entity\MessageDigestIntervalInterface $interval */
$this->derivatives[$id] = [
'id' => $id,
'title' => $interval
->label(),
'description' => $interval
->getDescription(),
'digest_interval' => $interval
->getInterval(),
];
$this->derivatives[$id] += $base_plugin_definition;
}
return parent::getDerivativeDefinitions($base_plugin_definition);
}
}
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:: |
|
DigestDeriver:: |
protected | property | The entity type manager. | |
DigestDeriver:: |
public static | function |
Creates a new class instance. Overrides ContainerDeriverInterface:: |
|
DigestDeriver:: |
public | function |
Gets the definition of all derivatives of a base plugin. Overrides DeriverBase:: |
|
DigestDeriver:: |
public | function | DigestDeriver constructor. | |
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. |