public function EntityDeriver::getDerivativeDefinitions in Zircon Profile 8.0
Same name in this branch
- 8.0 core/modules/rest/src/Plugin/Deriver/EntityDeriver.php \Drupal\rest\Plugin\Deriver\EntityDeriver::getDerivativeDefinitions()
- 8.0 core/lib/Drupal/Core/Entity/Plugin/DataType/Deriver/EntityDeriver.php \Drupal\Core\Entity\Plugin\DataType\Deriver\EntityDeriver::getDerivativeDefinitions()
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Entity/Plugin/DataType/Deriver/EntityDeriver.php \Drupal\Core\Entity\Plugin\DataType\Deriver\EntityDeriver::getDerivativeDefinitions()
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 DeriverInterface::getDerivativeDefinitions
See also
getDerivativeDefinition()
1 call to EntityDeriver::getDerivativeDefinitions()
- EntityDeriver::getDerivativeDefinition in core/
lib/ Drupal/ Core/ Entity/ Plugin/ DataType/ Deriver/ EntityDeriver.php - Gets the definition of a derivative plugin.
File
- core/
lib/ Drupal/ Core/ Entity/ Plugin/ DataType/ Deriver/ EntityDeriver.php, line 79 - Contains \Drupal\Core\Entity\Plugin\DataType\Deriver\EntityDeriver.
Class
- EntityDeriver
- Provides data type plugins for each existing entity type and bundle.
Namespace
Drupal\Core\Entity\Plugin\DataType\DeriverCode
public function getDerivativeDefinitions($base_plugin_definition) {
// Also keep the 'entity' defined as is.
$this->derivatives[''] = $base_plugin_definition;
// Add definitions for each entity type and bundle.
foreach ($this->entityManager
->getDefinitions() as $entity_type_id => $entity_type) {
$this->derivatives[$entity_type_id] = array(
'label' => $entity_type
->getLabel(),
'constraints' => $entity_type
->getConstraints(),
) + $base_plugin_definition;
// Incorporate the bundles as entity:$entity_type:$bundle, if any.
foreach (entity_get_bundles($entity_type_id) as $bundle => $bundle_info) {
if ($bundle !== $entity_type_id) {
$this->derivatives[$entity_type_id . ':' . $bundle] = array(
'label' => $bundle_info['label'],
'constraints' => $this->derivatives[$entity_type_id]['constraints'],
) + $base_plugin_definition;
}
}
}
return $this->derivatives;
}