You are here

public function DigestDeriver::getDerivativeDefinitions in Message Digest 8

Gets the definition of all derivatives of a base plugin.

Parameters

array $base_plugin_definition: The definition array of the base plugin.

Return value

array An array of full derivative definitions keyed on derivative id.

Overrides DeriverBase::getDerivativeDefinitions

See also

getDerivativeDefinition()

File

src/Plugin/Deriver/DigestDeriver.php, line 45

Class

DigestDeriver
Derive message digest plugins for various intervals.

Namespace

Drupal\message_digest\Plugin\Deriver

Code

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);
}