You are here

protected function LayoutBuilderEntityViewDisplayStorage::mapFromStorageRecords in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplayStorage.php \Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplayStorage::mapFromStorageRecords()
  2. 10 core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplayStorage.php \Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplayStorage::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/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplayStorage.php, line 34

Class

LayoutBuilderEntityViewDisplayStorage
Provides storage for entity view display entities that have layouts.

Namespace

Drupal\layout_builder\Entity

Code

protected function mapFromStorageRecords(array $records) {
  foreach ($records as $id => &$record) {
    if (!empty($record['third_party_settings']['layout_builder']['sections'])) {
      $sections =& $record['third_party_settings']['layout_builder']['sections'];
      $sections = array_map([
        Section::class,
        'fromArray',
      ], $sections);
    }
  }
  return parent::mapFromStorageRecords($records);
}