function SectionStorageTrait::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/SectionStorage/SectionStorageTrait.php, line 102

Class

SectionStorageTrait
Provides a trait for storing sections on an object.

Namespace

Drupal\layout_builder\SectionStorage

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

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