You are here

protected function LayoutBuilderEntityViewDisplayStorage::mapToStorageRecord in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplayStorage.php \Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplayStorage::mapToStorageRecord()
  2. 9 core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplayStorage.php \Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplayStorage::mapToStorageRecord()

Maps from an entity object to the storage record.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity object.

Return value

array The record to store.

Overrides ConfigEntityStorage::mapToStorageRecord

File

core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplayStorage.php, line 20

Class

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

Namespace

Drupal\layout_builder\Entity

Code

protected function mapToStorageRecord(EntityInterface $entity) {
  $record = parent::mapToStorageRecord($entity);
  if (!empty($record['third_party_settings']['layout_builder']['sections'])) {
    $record['third_party_settings']['layout_builder']['sections'] = array_map(function (Section $section) {
      return $section
        ->toArray();
    }, $record['third_party_settings']['layout_builder']['sections']);
  }
  return $record;
}