function AddModerationDeriver::getDerivativeDefinitions
Same name in other branches
- 10 core/modules/content_moderation/src/Plugin/ConfigAction/AddModerationDeriver.php \Drupal\content_moderation\Plugin\ConfigAction\AddModerationDeriver::getDerivativeDefinitions()
Overrides DeriverBase::getDerivativeDefinitions
File
-
core/
modules/ content_moderation/ src/ Plugin/ ConfigAction/ AddModerationDeriver.php, line 37
Class
Namespace
Drupal\content_moderation\Plugin\ConfigActionCode
public function getDerivativeDefinitions($base_plugin_definition) {
$inflector = new EnglishInflector();
foreach ($this->entityTypeManager
->getDefinitions() as $id => $entity_type) {
if ($bundle_entity_type = $entity_type->getBundleEntityType()) {
/** @var \Drupal\Core\Entity\EntityTypeInterface $bundle_entity_type */
$bundle_entity_type = $this->entityTypeManager
->getDefinition($bundle_entity_type);
// Convert unique plugin IDs, like `taxonomy_vocabulary`, into strings
// like `TaxonomyVocabulary`.
$suffix = Container::camelize($bundle_entity_type->id());
[
$suffix,
] = $inflector->pluralize($suffix);
$this->derivatives["add{$suffix}"] = [
'target_entity_type' => $id,
'admin_label' => $this->t('Add moderation to all @bundles', [
'@bundles' => $bundle_entity_type->getPluralLabel() ?: $bundle_entity_type->id(),
]),
] + $base_plugin_definition;
}
}
return parent::getDerivativeDefinitions($base_plugin_definition);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.