public function FormEntityProfileTypeDeriver::getDerivativeDefinitions in Flexiform 8
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/ FormEntityProfileTypeDeriver.php, line 69
Class
- FormEntityProfileTypeDeriver
- Provides a deriver class.
Namespace
Drupal\flexiform\Plugin\DeriverCode
public function getDerivativeDefinitions($base_plugin_definition) {
if (!\Drupal::moduleHandler()
->moduleExists('profile')) {
return [];
}
$entity_type = $this->entityTypeManager
->getDefinition('profile');
foreach ($this->entityBundleInfo
->getBundleInfo('profile') as $bundle => $bundle_info) {
$plugin_id = $bundle;
$this->derivatives[$plugin_id] = [
'label' => $this
->t('@bundle @profile from User', [
'@bundle' => $bundle_info['label'],
'@profile' => $entity_type
->getLabel(),
]),
'profile_type' => $bundle,
'context' => [
'user' => new ContextDefinition('entity:user', $this
->t('Base User')),
],
] + $base_plugin_definition;
}
return $this->derivatives;
}