function EntityDataDefinition::getBundles
Same name and namespace in other branches
- 10 core/lib/Drupal/Core/Entity/TypedData/EntityDataDefinition.php \Drupal\Core\Entity\TypedData\EntityDataDefinition::getBundles()
- 9 core/lib/Drupal/Core/Entity/TypedData/EntityDataDefinition.php \Drupal\Core\Entity\TypedData\EntityDataDefinition::getBundles()
- 8.9.x core/lib/Drupal/Core/Entity/TypedData/EntityDataDefinition.php \Drupal\Core\Entity\TypedData\EntityDataDefinition::getBundles()
- main core/lib/Drupal/Core/Entity/TypedData/EntityDataDefinition.php \Drupal\Core\Entity\TypedData\EntityDataDefinition::getBundles()
Gets the array of possible entity bundles.
Return value
array|null The array of possible bundles, or NULL for any.
Overrides EntityDataDefinitionInterface::getBundles
2 calls to EntityDataDefinition::getBundles()
- EntityDataDefinition::getDataType in core/
lib/ Drupal/ Core/ Entity/ TypedData/ EntityDataDefinition.php - Returns the data type of the data.
- EntityDataDefinition::getPropertyDefinitions in core/
lib/ Drupal/ Core/ Entity/ TypedData/ EntityDataDefinition.php - Gets an array of property definitions of contained properties.
File
-
core/
lib/ Drupal/ Core/ Entity/ TypedData/ EntityDataDefinition.php, line 142
Class
- EntityDataDefinition
- A typed data definition class for describing entities.
Namespace
Drupal\Core\Entity\TypedDataCode
public function getBundles() {
$bundle = NULL;
// With the update to Symfony 7.4, a constraint should be added with options
// as an associative array, with the keys of the array matching names of
// properties in the constraint plugin class. The 'Bundle' constraint
// definition here is expected to be an associative array with 'bundle' as
// the key. For backwards-compatibility, if the 'bundle' key does not exist,
// get the bundle value from the parent 'Bundle' key.
$bundle = $this->definition['constraints']['Bundle']['bundle'] ?? NULL;
if ($bundle === NULL && isset($this->definition['constraints']['Bundle'])) {
@trigger_error('Adding the "Bundle" constraint with options missing the "bundle" key is deprecated in drupal:11.4.0 and will not be supported in drupal:12.0.0. See https://www.drupal.org/node/3554746', E_USER_DEPRECATED);
$bundle = $this->definition['constraints']['Bundle'];
}
return is_string($bundle) ? [
$bundle,
] : $bundle;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.