function LayoutBuilderEntityViewDisplayStorage::mapToStorageRecord

Same name in other branches
  1. 9 core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplayStorage.php \Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplayStorage::mapToStorageRecord()
  2. 8.9.x core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplayStorage.php \Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplayStorage::mapToStorageRecord()
  3. 10 core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplayStorage.php \Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplayStorage::mapToStorageRecord()

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.