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