function SectionListTrait::__clone

Same name in other branches
  1. 9 core/modules/layout_builder/src/SectionListTrait.php \Drupal\layout_builder\SectionListTrait::__clone()
  2. 10 core/modules/layout_builder/src/SectionListTrait.php \Drupal\layout_builder\SectionListTrait::__clone()

Magic method: Implements a deep clone.

File

core/modules/layout_builder/src/SectionListTrait.php, line 175

Class

SectionListTrait
Provides a trait for maintaining a list of sections.

Namespace

Drupal\layout_builder

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.