Commit 4d5d0865 authored by webchick's avatar webchick

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

parent bdf5f4fc
......@@ -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}
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment