You are here

protected function ComponentFormController::openForm in Layout Paragraphs 2.0.x

Returns the form, with ajax if appropriate.

Parameters

array $form: The form.

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

Return value

array|AjaxResponse The form or ajax response.

1 call to ComponentFormController::openForm()
ComponentFormController::insertForm in src/Controller/ComponentFormController.php
Responds with a component insert form.

File

src/Controller/ComponentFormController.php, line 57

Class

ComponentFormController
Class definition for ComponentFormController.

Namespace

Drupal\layout_paragraphs\Controller

Code

protected function openForm(array $form, LayoutParagraphsLayout $layout_paragraphs_layout) {
  if ($this
    ->isAjax()) {
    $response = new AjaxResponse();
    $selector = $this
      ->dialogSelector($layout_paragraphs_layout);
    $response
      ->addCommand(new OpenDialogCommand($selector, $form['#title'], $form, $this
      ->dialogSettings()));
    return $response;
  }
  return $form;
}