function PermissionsPerBundleDeriver::getDerivativeDefinitions
Overrides DeriverBase::getDerivativeDefinitions
File
-
core/
lib/ Drupal/ Core/ Config/ Action/ Plugin/ ConfigAction/ Deriver/ PermissionsPerBundleDeriver.php, line 35
Class
- PermissionsPerBundleDeriver
- @internal This API is experimental.
Namespace
Drupal\Core\Config\Action\Plugin\ConfigAction\DeriverCode
public function getDerivativeDefinitions($base_plugin_definition) {
foreach ($this->entityTypeManager
->getDefinitions() as $id => $entity_type) {
if ($entity_type->getPermissionGranularity() === 'bundle' && ($bundle_entity_type = $entity_type->getBundleEntityType()) !== NULL) {
// Convert unique plugin IDs, like `taxonomy_vocabulary`, into strings
// like `TaxonomyVocabulary`.
$suffix = Container::camelize($bundle_entity_type);
$this->derivatives["grantPermissionsForEach{$suffix}"] = [
'target_entity_type' => $id,
] + $base_plugin_definition;
}
}
return parent::getDerivativeDefinitions($base_plugin_definition);
}