You are here

public function ConfirmDeleteEditorNoteForm::submitModalFormAjax in Editor Notes 8

Ajax callback for the "Submit" button.

Remove table row and close modal dialog.

Parameters

array $form: The Form.

\Drupal\Core\Form\FormStateInterface $form_state: The form state object.

Return value

\Drupal\Core\Ajax\AjaxResponse Ajax response.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

File

src/Form/ConfirmDeleteEditorNoteForm.php, line 116

Class

ConfirmDeleteEditorNoteForm
Class ConfirmDeleteEditorNoteForm.

Namespace

Drupal\editor_note\Form

Code

public function submitModalFormAjax(array $form, FormStateInterface $form_state) {
  $response = new AjaxResponse();
  if ($this->editorNote) {
    $replace_command = $this->editorNoteHelper
      ->getWidgetAjaxReplaceCommand($this->editorNote);
    $response
      ->addCommand($replace_command);
  }
  $command = new CloseModalDialogCommand();
  $response
    ->addCommand($command);
  return $response;
}