public function DigestIntervalActionDeriver::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
- message_digest_ui/
src/ Plugin/ Derivative/ DigestIntervalActionDeriver.php, line 55
Class
- DigestIntervalActionDeriver
- Derives action plugins for changing digest intervals.
Namespace
Drupal\message_digest_ui\Plugin\DerivativeCode
public function getDerivativeDefinitions($base_plugin_definition) {
// This is called very early during installation, and the flag service
// is not completely ready, so these are hardcoded for the time being.
$flags = [
'email_node' => 'node',
'email_term' => 'taxonomy_term',
'email_user' => 'user',
];
foreach ($flags as $flag_id => $entity_type_id) {
// Create a set of actions for each email flag/entity combination.
$plugin = [
'type' => $entity_type_id,
];
foreach ($this
->getDigestNotifiers() as $plugin_id => $label) {
$id = $flag_id . ':' . ($plugin_id ?: 'immediate');
$plugin['label'] = $label;
$plugin['id'] = $id;
$this->derivatives[$id] = $plugin + $base_plugin_definition;
}
}
return parent::getDerivativeDefinitions($base_plugin_definition);
}