public function SectionStorageTrait::removeSection in Drupal 8
1 call to SectionStorageTrait::removeSection()
- LayoutBuilderEntityViewDisplay::onDependencyRemoval in core/
modules/ layout_builder/ src/ Entity/ LayoutBuilderEntityViewDisplay.php - Informs the entity that entities it depends on will be deleted.
File
- core/
modules/ layout_builder/ src/ SectionStorage/ SectionStorageTrait.php, line 132
Class
- SectionStorageTrait
- Provides a trait for storing sections on an object.
Namespace
Drupal\layout_builder\SectionStorageCode
public function removeSection($delta) {
// Clear the section list if there is currently a blank section.
if ($this
->hasBlankSection()) {
$this
->removeAllSections();
}
$sections = $this
->getSections();
unset($sections[$delta]);
$this
->setSections($sections);
// Add a blank section when the last section is removed.
if (empty($sections)) {
$this
->addBlankSection();
}
return $this;
}