You are here

public function FieldManager::getAllFieldConfigsForField in Scheduled Updates 8

Get all the instances of field for an entity type.

Parameters

\Drupal\Core\Field\FieldStorageDefinitionInterface $definition:

string $entity_type_id:

Return value

\Drupal\Core\Field\FieldDefinitionInterface[]

Overrides FieldManagerInterface::getAllFieldConfigsForField

1 call to FieldManager::getAllFieldConfigsForField()
FieldManager::updateExistingReferenceFields in src/FieldManager.php
Update existing Entity reference fields to have the bundle as a target.

File

src/FieldManager.php, line 138
Contains \Drupal\scheduled_updates\FieldManager.

Class

FieldManager
Field Manager for handling fields for Scheduled Updates.

Namespace

Drupal\scheduled_updates

Code

public function getAllFieldConfigsForField(FieldStorageDefinitionInterface $definition, $entity_type_id) {
  $map = $this->entityFieldManager
    ->getFieldMap()[$entity_type_id];
  $definitions = [];
  $field_name = $definition
    ->getName();
  if (isset($map[$field_name])) {
    $bundles = $map[$field_name]['bundles'];
    foreach ($bundles as $bundle) {
      $definitions[$bundle] = $this
        ->getFieldDefinition($entity_type_id, $bundle, $field_name);
    }
  }
  return $definitions;
}