rebuildLayout example

/** * 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 rebuildAndClose(SectionStorageInterface $section_storage) {
    $response = $this->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. */
// If a preceding block was specified, insert after that. Otherwise add the     // block to the front.     $component->setRegion($region_to);
    if (isset($preceding_block_uuid)) {
      $section->insertAfterComponent($preceding_block_uuid$component);
    }
    else {
      $section->insertComponent(0, $component);
    }

    $this->layoutTempstoreRepository->set($section_storage);
    return $this->rebuildLayout($section_storage);
  }

}
Home | Imprint | This part of the site doesn't use cookies.