You are here

public function SectionStorageTrait::__clone in Drupal 8

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