X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Flayout_builder%2Fsrc%2FSectionStorage%2FSectionStorageTrait.php;h=36729d2ba6240d0377c9adf6cc7734d317c5c5fc;hb=5b8bb166bfa98770daef9de5c127fc2e6ef02340;hp=9d942c7ad85982898e0480f3f7cac4d075b2f83e;hpb=af6d1fb995500ae68849458ee10d66abbdcfb252;p=yaffs-website diff --git a/web/core/modules/layout_builder/src/SectionStorage/SectionStorageTrait.php b/web/core/modules/layout_builder/src/SectionStorage/SectionStorageTrait.php index 9d942c7ad..36729d2ba 100644 --- a/web/core/modules/layout_builder/src/SectionStorage/SectionStorageTrait.php +++ b/web/core/modules/layout_builder/src/SectionStorage/SectionStorageTrait.php @@ -111,4 +111,17 @@ trait SectionStorageTrait { return isset($this->getSections()[$delta]); } + /** + * Magic method: Implements a deep clone. + */ + public function __clone() { + $sections = $this->getSections(); + + foreach ($sections as $delta => $item) { + $sections[$delta] = clone $item; + } + + $this->setSections($sections); + } + }