function SectionListTrait::getSection

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/src/SectionListTrait.php \Drupal\layout_builder\SectionListTrait::getSection()
  2. 10 core/modules/layout_builder/src/SectionListTrait.php \Drupal\layout_builder\SectionListTrait::getSection()
1 call to SectionListTrait::getSection()
LayoutBuilderEntityViewDisplay::getDefaultSection in core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php
Gets a default section.

File

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

Class

SectionListTrait
Provides a trait for maintaining a list of sections.

Namespace

Drupal\layout_builder

Code

public function getSection($delta) {
    if (!$this->hasSection($delta)) {
        throw new \OutOfBoundsException(sprintf('Invalid delta "%s"', $delta));
    }
    return $this->getSections()[$delta];
}

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