You are here

protected function SectionListTrait::setSection in Drupal 10

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/src/SectionListTrait.php \Drupal\layout_builder\SectionListTrait::setSection()

Sets the section for the given delta on the display.

Parameters

int $delta: The delta of the section.

\Drupal\layout_builder\Section $section: The layout section.

Return value

$this

File

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

Class

SectionListTrait
Provides a trait for maintaining a list of sections.

Namespace

Drupal\layout_builder

Code

protected function setSection($delta, Section $section) {
  $sections = $this
    ->getSections();
  $sections[$delta] = $section;
  $this
    ->setSections($sections);
  return $this;
}