function AddSectionController::build
Same name in other branches
- 9 core/modules/layout_builder/src/Controller/AddSectionController.php \Drupal\layout_builder\Controller\AddSectionController::build()
- 10 core/modules/layout_builder/src/Controller/AddSectionController.php \Drupal\layout_builder\Controller\AddSectionController::build()
- 11.x core/modules/layout_builder/src/Controller/AddSectionController.php \Drupal\layout_builder\Controller\AddSectionController::build()
Adds the new section.
Parameters
\Drupal\layout_builder\SectionStorageInterface $section_storage: The section storage.
int $delta: The delta of the section to splice.
string $plugin_id: The plugin ID of the layout to add.
Return value
\Symfony\Component\HttpFoundation\Response The controller response.
1 string reference to 'AddSectionController::build'
- layout_builder.routing.yml in core/
modules/ layout_builder/ layout_builder.routing.yml - core/modules/layout_builder/layout_builder.routing.yml
File
-
core/
modules/ layout_builder/ src/ Controller/ AddSectionController.php, line 63
Class
- AddSectionController
- Defines a controller to add a new section.
Namespace
Drupal\layout_builder\ControllerCode
public function build(SectionStorageInterface $section_storage, $delta, $plugin_id) {
$section_storage->insertSection($delta, new Section($plugin_id));
$this->layoutTempstoreRepository
->set($section_storage);
if ($this->isAjax()) {
return $this->rebuildAndClose($section_storage);
}
else {
$url = $section_storage->getLayoutBuilderUrl();
return new RedirectResponse($url->setAbsolute()
->toString());
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.