You are here

protected function SectionListTrait::addBlankSection in Drupal 9

Same name and namespace in other branches
  1. 10 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

2 calls to SectionListTrait::addBlankSection()
SectionListTrait::removeAllSections 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 102

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