You are here

protected function FieldConfigStorageBase::mapFromStorageRecords in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Field/FieldConfigStorageBase.php \Drupal\Core\Field\FieldConfigStorageBase::mapFromStorageRecords()
  2. 9 core/lib/Drupal/Core/Field/FieldConfigStorageBase.php \Drupal\Core\Field\FieldConfigStorageBase::mapFromStorageRecords()

Maps from storage records to entity objects.

Parameters

array $records: Associative array of query results, keyed on the entity ID.

Return value

\Drupal\Core\Entity\EntityInterface[] An array of entity objects implementing the EntityInterface.

Overrides EntityStorageBase::mapFromStorageRecords

File

core/lib/Drupal/Core/Field/FieldConfigStorageBase.php, line 24

Class

FieldConfigStorageBase
Base storage class for field config entities.

Namespace

Drupal\Core\Field

Code

protected function mapFromStorageRecords(array $records) {
  foreach ($records as $id => &$record) {
    try {
      $class = $this->fieldTypeManager
        ->getPluginClass($record['field_type']);
    } catch (PluginNotFoundException $e) {
      $config_id = $this
        ->getPrefix() . $id;
      throw new PluginNotFoundException($record['field_type'], "Unable to determine class for field type '{$record['field_type']}' found in the '{$config_id}' configuration", $e
        ->getCode(), $e);
    }
    $record['settings'] = $class::fieldSettingsFromConfigData($record['settings']);
  }
  return parent::mapFromStorageRecords($records);
}