You are here

protected function SectionListTrait::addBlankSection in Drupal 10

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/src/SectionListTrait.php \Drupal\layout_builder\SectionListTrait::addBlankSection()

Adds a blank section to the list.

Return value

$this

See also

\Drupal\layout_builder\Plugin\Layout\BlankLayout

File

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

Class

SectionListTrait
Provides a trait for maintaining a list of sections.

Namespace

Drupal\layout_builder

Code

protected function addBlankSection() {
  if ($this
    ->hasSection(0)) {
    throw new \Exception('A blank section must only be added to an empty list');
  }
  $this
    ->appendSection(new Section('layout_builder_blank'));
  return $this;
}