You are here

public function LayoutParagraphsBuilderController::build in Layout Paragraphs 2.0.x

Builds the layout paragraphs builder form.

Parameters

\Drupal\layout_paragraphs\LayoutParagraphsLayout $layout_paragraphs_layout: The layout paragraphs layout object.

Return value

mixed An ajax response or the form.

1 string reference to 'LayoutParagraphsBuilderController::build'
layout_paragraphs.routing.yml in ./layout_paragraphs.routing.yml
layout_paragraphs.routing.yml

File

src/Controller/LayoutParagraphsBuilderController.php, line 29

Class

LayoutParagraphsBuilderController
Class LayoutParagraphsBuilderController.

Namespace

Drupal\layout_paragraphs\Controller

Code

public function build(LayoutParagraphsLayout $layout_paragraphs_layout) {
  $form = $this
    ->formBuilder()
    ->getForm('\\Drupal\\layout_paragraphs\\Form\\LayoutParagraphsBuilderForm', $layout_paragraphs_layout);
  if ($this
    ->isAjax()) {
    $response = new AjaxResponse();
    $response
      ->addCommand(new ReplaceCommand('[data-lpb-id="' . $layout_paragraphs_layout
      ->id() . '"]', $form));
    return $response;
  }
  return $form;
}