function SectionListTrait::removeAllSections

Same name in other branches
  1. 10 core/modules/layout_builder/src/SectionListTrait.php \Drupal\layout_builder\SectionListTrait::removeAllSections()
  2. 11.x 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 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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.