You are here

public function SectionListTrait::removeAllSections in Drupal 9

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

File

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

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