function EntityBundle::getDerivativeDefinitions
Same name in other branches
- 8.x-3.x src/Plugin/Deriver/EntityBundle.php \Drupal\ctools\Plugin\Deriver\EntityBundle::getDerivativeDefinitions()
Overrides DeriverBase::getDerivativeDefinitions
File
-
src/
Plugin/ Deriver/ EntityBundle.php, line 15
Class
- EntityBundle
- Deriver that creates a condition for each entity type with bundles.
Namespace
Drupal\ctools\Plugin\DeriverCode
public function getDerivativeDefinitions($base_plugin_definition) {
// Do not define any derivatives on Drupal 9.3+, instead, replace the core
// class in ctools_condition_info_alter().
if (\version_compare(\Drupal::VERSION, '9.3', '>')) {
return [];
}
foreach ($this->entityTypeManager
->getDefinitions() as $entity_type_id => $entity_type) {
if ($entity_type->hasKey('bundle')) {
$this->derivatives[$entity_type_id] = $base_plugin_definition;
$this->derivatives[$entity_type_id]['label'] = $this->getEntityBundleLabel($entity_type);
$this->derivatives[$entity_type_id]['context_definitions'] = [
"{$entity_type_id}" => new EntityContextDefinition('entity:' . $entity_type_id),
];
}
}
return $this->derivatives;
}