You are here

public function SectionListTrait::removeAllSections in Drupal 10

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/src/SectionListTrait.php \Drupal\layout_builder\SectionListTrait::removeAllSections()
1 call to SectionListTrait::removeAllSections()
LayoutBuilderEntityViewDisplay::preSave in core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php
Acts on an entity before the presave hook is invoked.

File

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

Class

SectionListTrait
Provides a trait for maintaining a list of sections.

Namespace

Drupal\layout_builder

Code

public function removeAllSections($set_blank = FALSE) {
  $this
    ->setSections([]);
  if ($set_blank) {
    $this
      ->addBlankSection();
  }
  return $this;
}