function SectionStorageTrait::__clone

Magic method: Implements a deep clone.

File

core/modules/layout_builder/src/SectionStorage/SectionStorageTrait.php, line 175

Class

SectionStorageTrait
Provides a trait for storing sections on an object.

Namespace

Drupal\layout_builder\SectionStorage

Code

public function __clone() {
    $sections = $this->getSections();
    foreach ($sections as $delta => $item) {
        $sections[$delta] = clone $item;
    }
    $this->setSections($sections);
}

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