function SectionListTrait::hasBlankSection

Same name in other branches
  1. 9 core/modules/layout_builder/src/SectionListTrait.php \Drupal\layout_builder\SectionListTrait::hasBlankSection()
  2. 10 core/modules/layout_builder/src/SectionListTrait.php \Drupal\layout_builder\SectionListTrait::hasBlankSection()

Indicates if this section list contains a blank section.

A blank section is used to differentiate the difference between a layout that has never been instantiated and one that has purposefully had all sections removed.

Return value

bool TRUE if the section list contains a blank section, FALSE otherwise.

See also

\Drupal\layout_builder\Plugin\Layout\BlankLayout

3 calls to SectionListTrait::hasBlankSection()
SectionListTrait::count in core/modules/layout_builder/src/SectionListTrait.php
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 123

Class

SectionListTrait
Provides a trait for maintaining a list of sections.

Namespace

Drupal\layout_builder

Code

protected function hasBlankSection() {
    // A blank section will only ever exist when the delta is 0, as added by
    // ::removeSection().
    return $this->hasSection(0) && $this->getSection(0)
        ->getLayoutId() === 'layout_builder_blank';
}

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