rebuildLayout($section_storage); $response->addCommand(new CloseDialogCommand('#drupal-off-canvas')); return $response; } /** * Rebuilds the layout. * * @param \Drupal\layout_builder\SectionStorageInterface $section_storage * The section storage. * * @return \Drupal\Core\Ajax\AjaxResponse * An AJAX response to either rebuild the layout and close the dialog, or * reload the page. */ protected function rebuildLayout(SectionStorageInterface $section_storage) { $response = new AjaxResponse(); $layout_controller = $this->classResolver->getInstanceFromDefinition(LayoutBuilderController::class); $layout = $layout_controller->layout($section_storage, TRUE); $response->addCommand(new ReplaceCommand('#layout-builder', $layout)); return $response; } }