public function EntityFieldConditionDeriver::getDerivativeDefinitions in Entity Field Condition 2.0.x
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
- src/
Plugin/ Deriver/ EntityFieldConditionDeriver.php, line 51
Class
- EntityFieldConditionDeriver
- Define the entity field condition deriver.
Namespace
Drupal\entity_field_condition\Plugin\DeriverCode
public function getDerivativeDefinitions($base_plugin_definition) : array {
if (empty($this->derivatives)) {
foreach ($this->entityTypeManager
->getDefinitions() as $type => $definition) {
if (!$definition instanceof ContentEntityTypeInterface || !$definition
->entityClassImplements(FieldableEntityInterface::class)) {
continue;
}
$this->derivatives[$type] = $base_plugin_definition;
$this->derivatives[$type]['label'] = $this
->t('@entity_type Field', [
'@entity_type' => $definition
->getLabel(),
]);
$this->derivatives[$type]['context_definitions'] = [
'entity' => new EntityContextDefinition("entity:{$type}", $this
->t('@entity_type', [
'@entity_type' => $definition
->getLabel(),
])),
];
}
}
return $this->derivatives;
}