function EditorLinkDialog::submitForm

Same name in other branches
  1. 9 core/modules/editor/src/Form/EditorLinkDialog.php \Drupal\editor\Form\EditorLinkDialog::submitForm()
  2. 10 core/modules/editor/src/Form/EditorLinkDialog.php \Drupal\editor\Form\EditorLinkDialog::submitForm()

Overrides FormInterface::submitForm

File

core/modules/editor/src/Form/EditorLinkDialog.php, line 73

Class

EditorLinkDialog
Provides a link dialog for text editors.

Namespace

Drupal\editor\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
    $response = new AjaxResponse();
    if ($form_state->getErrors()) {
        unset($form['#prefix'], $form['#suffix']);
        $form['status_messages'] = [
            '#type' => 'status_messages',
            '#weight' => -10,
        ];
        $response->addCommand(new HtmlCommand('#editor-link-dialog-form', $form));
    }
    else {
        $response->addCommand(new EditorDialogSave($form_state->getValues()));
        $response->addCommand(new CloseModalDialogCommand());
    }
    return $response;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.