X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Flayout_builder%2Fsrc%2FField%2FLayoutSectionItemList.php;fp=web%2Fcore%2Fmodules%2Flayout_builder%2Fsrc%2FField%2FLayoutSectionItemList.php;h=a2ceca1373819bc00c91a9d323385c8e5cab1b45;hp=0000000000000000000000000000000000000000;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0 diff --git a/web/core/modules/layout_builder/src/Field/LayoutSectionItemList.php b/web/core/modules/layout_builder/src/Field/LayoutSectionItemList.php new file mode 100644 index 000000000..a2ceca137 --- /dev/null +++ b/web/core/modules/layout_builder/src/Field/LayoutSectionItemList.php @@ -0,0 +1,55 @@ +list as $delta => $item) { + $sections[$delta] = $item->section; + } + return $sections; + } + + /** + * {@inheritdoc} + */ + protected function setSections(array $sections) { + $this->list = []; + $sections = array_values($sections); + /** @var \Drupal\layout_builder\Plugin\Field\FieldType\LayoutSectionItem $item */ + foreach ($sections as $section) { + $item = $this->appendItem(); + $item->section = $section; + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function __wakeup() { + // Ensure the entity is updated with the latest value. + $this->getEntity()->set($this->getName(), $this->getValue()); + } + +}