Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. LayoutRebuildTrait.php

function 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;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal