You are here

public function FieldStorageConfig::getBundles in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/field/src/Entity/FieldStorageConfig.php \Drupal\field\Entity\FieldStorageConfig::getBundles()

Returns the list of bundles where the field storage has fields.

Return value

array An array of bundle names.

Overrides FieldStorageConfigInterface::getBundles

1 call to FieldStorageConfig::getBundles()
FieldStorageConfig::isDeletable in core/modules/field/src/Entity/FieldStorageConfig.php
Checks if the field storage can be deleted.

File

core/modules/field/src/Entity/FieldStorageConfig.php, line 500

Class

FieldStorageConfig
Defines the Field storage configuration entity.

Namespace

Drupal\field\Entity

Code

public function getBundles() {
  if (!$this
    ->isDeleted()) {
    $map = \Drupal::service('entity_field.manager')
      ->getFieldMap();
    if (isset($map[$this
      ->getTargetEntityTypeId()][$this
      ->getName()]['bundles'])) {
      return $map[$this
        ->getTargetEntityTypeId()][$this
        ->getName()]['bundles'];
    }
  }
  return [];
}