protected function LayoutStorageHandler::mapFromStorageRecords in Layout builder library 8
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/
LayoutStorageHandler.php, line 32
Class
- LayoutStorageHandler
- Defines a class for storing layout config entities.
Namespace
Drupal\layout_libraryCode
protected function mapFromStorageRecords(array $records) {
foreach ($records as $id => &$record) {
if (!empty($record['layout'])) {
$sections =& $record['layout'];
foreach ($sections as $section_delta => $section) {
$sections[$section_delta] = new Section($section['layout_id'], $section['layout_settings'], array_map(function (array $component) {
return (new SectionComponent($component['uuid'], $component['region'], $component['configuration'], $component['additional']))
->setWeight($component['weight']);
}, $section['components']));
}
}
}
return parent::mapFromStorageRecords($records);
}