function EntityDataDefinition::getBundles

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Entity/TypedData/EntityDataDefinition.php \Drupal\Core\Entity\TypedData\EntityDataDefinition::getBundles()
  2. 10 core/lib/Drupal/Core/Entity/TypedData/EntityDataDefinition.php \Drupal\Core\Entity\TypedData\EntityDataDefinition::getBundles()
  3. 11.x core/lib/Drupal/Core/Entity/TypedData/EntityDataDefinition.php \Drupal\Core\Entity\TypedData\EntityDataDefinition::getBundles()

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 133

Class

EntityDataDefinition
A typed data definition class for describing entities.

Namespace

Drupal\Core\Entity\TypedData

Code

public function getBundles() {
    $bundle = $this->definition['constraints']['Bundle'] ?? NULL;
    return is_string($bundle) ? [
        $bundle,
    ] : $bundle;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.