function LayoutSectionItemList::preSave

Same name in other branches
  1. 9 core/modules/layout_builder/src/Field/LayoutSectionItemList.php \Drupal\layout_builder\Field\LayoutSectionItemList::preSave()
  2. 8.9.x core/modules/layout_builder/src/Field/LayoutSectionItemList.php \Drupal\layout_builder\Field\LayoutSectionItemList::preSave()
  3. 11.x core/modules/layout_builder/src/Field/LayoutSectionItemList.php \Drupal\layout_builder\Field\LayoutSectionItemList::preSave()

Overrides FieldItemList::preSave

File

core/modules/layout_builder/src/Field/LayoutSectionItemList.php, line 72

Class

LayoutSectionItemList
Defines an item list class for layout section fields.

Namespace

Drupal\layout_builder\Field

Code

public function preSave() {
    parent::preSave();
    // Loop through each section and reconstruct it to ensure that all default
    // values are present.
    foreach ($this->list as $item) {
        $item->section = Section::fromArray($item->section
            ->toArray());
    }
}

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