You are here

public function FormEntityAddForm::ajaxSubmit in Flexiform 8

Ajax the plugin selection.

Overrides FormEntityBaseForm::ajaxSubmit

File

src/Form/FormEntityAddForm.php, line 87

Class

FormEntityAddForm
Provides a form for adding new entity forms.

Namespace

Drupal\flexiform\Form

Code

public function ajaxSubmit(array $form, FormStateInterface $form_state) {
  $response = new AjaxResponse();
  if ($form_state
    ->get('selected_form_entity')) {
    $response
      ->addCommand(new ReplaceCommand('#flexiform-form-entity-add-wrapper', $form));
    $response
      ->addCommand(new SetDialogTitleCommand(NULL, $this
      ->t('Configure form entity')));
  }
  else {
    $response
      ->addCommand(new CloseModalDialogCommand());
  }
  return $response;
}