function LayoutRebuildTrait::rebuildLayout

Same name in other branches
  1. 9 core/modules/layout_builder/src/Controller/LayoutRebuildTrait.php \Drupal\layout_builder\Controller\LayoutRebuildTrait::rebuildLayout()
  2. 8.9.x core/modules/layout_builder/src/Controller/LayoutRebuildTrait.php \Drupal\layout_builder\Controller\LayoutRebuildTrait::rebuildLayout()
  3. 10 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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.