You are here

protected function LayoutBuilderStorage::mapFromStorageRecords in Page Manager 8.4

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

src/Entity/LayoutBuilderStorage.php, line 31

Class

LayoutBuilderStorage
Provides storage for page manager entities that have layouts.

Namespace

Drupal\page_manager\Entity

Code

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