You are here

protected function LayoutRebuildTrait::rebuildLayout in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/src/Controller/LayoutRebuildTrait.php \Drupal\layout_builder\Controller\LayoutRebuildTrait::rebuildLayout()
  2. 9 core/modules/layout_builder/src/Controller/LayoutRebuildTrait.php \Drupal\layout_builder\Controller\LayoutRebuildTrait::rebuildLayout()

Rebuilds the layout.

Parameters

\Drupal\layout_builder\SectionStorageInterface $section_storage: The section storage.

Return value

\Drupal\Core\Ajax\AjaxResponse An AJAX response to either rebuild the layout and close the dialog, or reload the page.

2 calls to LayoutRebuildTrait::rebuildLayout()
LayoutRebuildTrait::rebuildAndClose in core/modules/layout_builder/src/Controller/LayoutRebuildTrait.php
Rebuilds the layout.
MoveBlockController::build in core/modules/layout_builder/src/Controller/MoveBlockController.php
Moves a block to another region.

File

core/modules/layout_builder/src/Controller/LayoutRebuildTrait.php, line 41

Class

LayoutRebuildTrait
Provides AJAX responses to rebuild the Layout Builder.

Namespace

Drupal\layout_builder\Controller

Code

protected function rebuildLayout(SectionStorageInterface $section_storage) {
  $response = new AjaxResponse();
  $layout = [
    '#type' => 'layout_builder',
    '#section_storage' => $section_storage,
  ];
  $response
    ->addCommand(new ReplaceCommand('#layout-builder', $layout));
  return $response;
}