You are here

protected function SectionStorageTrait::addBlankSection in Drupal 8

Adds a blank section to the list.

Return value

$this

See also

\Drupal\layout_builder\Plugin\Layout\BlankLayout

2 calls to SectionStorageTrait::addBlankSection()
SectionStorageTrait::removeAllSections 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 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;
}