protected function LayoutParagraphsLayoutRefreshTrait::refreshLayout in Layout Paragraphs 2.0.x
Decorates an ajax response with a command to refresh an entire layout.
Parameters
\Drupal\Core\Ajax\AjaxResponse $response: The ajax response to decorate.
Return value
\Drupal\Core\Ajax\AjaxResponse The ajax response.
3 calls to LayoutParagraphsLayoutRefreshTrait::refreshLayout()
- DeleteComponentForm::deleteComponent in src/
Form/ DeleteComponentForm.php - Ajax callback - deletes component and closes the form.
- EditComponentForm::successfulAjaxSubmit in src/
Form/ EditComponentForm.php - Allows the form to respond to a successful AJAX submission.
- InsertComponentForm::successfulAjaxSubmit in src/
Form/ InsertComponentForm.php - Allows the form to respond to a successful AJAX submission.
File
- src/
LayoutParagraphsLayoutRefreshTrait.php, line 72
Class
- LayoutParagraphsLayoutRefreshTrait
- Trait for managing refresh state for layouts.
Namespace
Drupal\layout_paragraphsCode
protected function refreshLayout(AjaxResponse $response) {
$layout = $this
->renderLayout();
$dom_selector = '[data-lpb-id="' . $this->layoutParagraphsLayout
->id() . '"]';
$response
->addCommand(new ReplaceCommand($dom_selector, $layout));
return $response;
}