Skip to content
Snippets Groups Projects
Commit 4d5d0865 authored by Angie Byron's avatar Angie Byron
Browse files

Issue #2077973 by plopesc: Modernize editor.module forms.

parent bdf5f4fc
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -7,7 +7,7 @@
namespace Drupal\editor\Form;
use Drupal\Core\Form\FormInterface;
use Drupal\Core\Form\FormBase;
use Drupal\filter\Entity\FilterFormat;
use Drupal\Core\Ajax\AjaxResponse;
use Drupal\Core\Ajax\HtmlCommand;
......@@ -17,7 +17,7 @@
/**
* Provides a link dialog for text editors.
*/
class EditorLinkDialog implements FormInterface {
class EditorLinkDialog extends FormBase {
/**
* {@inheritdoc}
......@@ -45,14 +45,14 @@ public function buildForm(array $form, array &$form_state, FilterFormat $filter_
// Everything under the "attributes" key is merged directly into the
// generated link tag's attributes.
$form['attributes']['href'] = array(
'#title' => t('URL'),
'#title' => $this->t('URL'),
'#type' => 'textfield',
'#default_value' => isset($input['href']) ? $input['href'] : '',
'#maxlength' => 2048,
);
$form['attributes']['target'] = array(
'#title' => t('Open in new window'),
'#title' => $this->t('Open in new window'),
'#type' => 'checkbox',
'#default_value' => !empty($input['target']),
'#return_value' => '_blank',
......@@ -63,7 +63,7 @@ public function buildForm(array $form, array &$form_state, FilterFormat $filter_
);
$form['actions']['save_modal'] = array(
'#type' => 'submit',
'#value' => t('Save'),
'#value' => $this->t('Save'),
// No regular submit-handler. This form only works via JavaScript.
'#submit' => array(),
'#ajax' => array(
......@@ -75,12 +75,6 @@ public function buildForm(array $form, array &$form_state, FilterFormat $filter_
return $form;
}
/**
* {@inheritdoc}
*/
public function validateForm(array &$form, array &$form_state) {
}
/**
* {@inheritdoc}
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment