You are here

protected function SectionListTrait::setSection in Drupal 9

Same name and namespace in other branches
  1. 10 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

1 call to SectionListTrait::setSection()
SectionListTrait::appendSection in core/modules/layout_builder/src/SectionListTrait.php

File

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

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