function CreateForEachBundleDeriver::getDerivativeDefinitions
Overrides DeriverBase::getDerivativeDefinitions
File
-
core/
lib/ Drupal/ Core/ Config/ Action/ Plugin/ ConfigAction/ Deriver/ CreateForEachBundleDeriver.php, line 37
Class
- CreateForEachBundleDeriver
- Generates derivatives for the create_for_each_bundle config action.
Namespace
Drupal\Core\Config\Action\Plugin\ConfigAction\DeriverCode
public function getDerivativeDefinitions($base_plugin_definition) : array {
// The action should only be available for entity types that are bundles of
// another entity type, such as node types, media types, taxonomy
// vocabularies, and so forth.
$bundle_entity_types = array_filter($this->entityTypeManager
->getDefinitions(), fn(EntityTypeInterface $entity_type) => is_string($entity_type->getBundleOf()));
$base_plugin_definition['entity_types'] = array_keys($bundle_entity_types);
$this->derivatives['createForEachIfNotExists'] = $base_plugin_definition + [
'create_action' => 'createIfNotExists',
];
$this->derivatives['createForEach'] = $base_plugin_definition + [
'create_action' => 'create',
];
return $this->derivatives;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.