protected function LayoutBuilderEntityViewDisplay::setSections in Drupal 9
Same name and namespace in other branches
- 8 core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php \Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay::setSections()
- 10 core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php \Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay::setSections()
Stores the information for all sections.
Implementations of this method are expected to call array_values() to rekey the list of sections.
Parameters
\Drupal\layout_builder\Section[] $sections: An array of section objects.
Return value
$this
Overrides SectionListTrait::setSections
File
- core/
modules/ layout_builder/ src/ Entity/ LayoutBuilderEntityViewDisplay.php, line 110
Class
- LayoutBuilderEntityViewDisplay
- Provides an entity view display entity that has a layout.
Namespace
Drupal\layout_builder\EntityCode
protected function setSections(array $sections) {
// Third-party settings must be completely unset instead of stored as an
// empty array.
if (!$sections) {
$this
->unsetThirdPartySetting('layout_builder', 'sections');
}
else {
$this
->setThirdPartySetting('layout_builder', 'sections', array_values($sections));
}
return $this;
}