You are here

public function SectionStorageTrait::removeAllSections in Drupal 8

3 calls to SectionStorageTrait::removeAllSections()
LayoutBuilderEntityViewDisplay::preSave in core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php
Acts on an entity before the presave hook is invoked.
SectionStorageTrait::insertSection in core/modules/layout_builder/src/SectionStorage/SectionStorageTrait.php
SectionStorageTrait::removeSection in core/modules/layout_builder/src/SectionStorage/SectionStorageTrait.php

File

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

Class

SectionStorageTrait
Provides a trait for storing sections on an object.

Namespace

Drupal\layout_builder\SectionStorage

Code

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