diff --git a/core/modules/editor/lib/Drupal/editor/Form/EditorImageDialog.php b/core/modules/editor/lib/Drupal/editor/Form/EditorImageDialog.php index 0807210..353b94b 100644 --- a/core/modules/editor/lib/Drupal/editor/Form/EditorImageDialog.php +++ b/core/modules/editor/lib/Drupal/editor/Form/EditorImageDialog.php @@ -7,19 +7,18 @@ 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; use Drupal\editor\Ajax\EditorDialogSave; use Drupal\Core\Ajax\CloseModalDialogCommand; -use Drupal\Core\StreamWrapper\LocalStream; -use Drupal\file\FileInterface; + /** * Provides an image dialog for text editors. */ -class EditorImageDialog implements FormInterface { +class EditorImageDialog extends FormBase { /** * {@inheritdoc} @@ -59,7 +58,7 @@ public function buildForm(array $form, array &$form_state, FilterFormat $filter_ $fid = $existing_file ? $existing_file->id() : NULL; $form['fid'] = array( - '#title' => t('Image'), + '#title' => $this->t('Image'), '#type' => 'managed_file', '#upload_location' => $editor->image_upload['scheme'] . '://' .$editor->image_upload['directory'], '#default_value' => $fid ? array($fid) : NULL, @@ -72,7 +71,7 @@ public function buildForm(array $form, array &$form_state, FilterFormat $filter_ ); $form['attributes']['src'] = array( - '#title' => t('URL'), + '#title' => $this->t('URL'), '#type' => 'textfield', '#default_value' => isset($input['src']) ? $input['src'] : '', '#maxlength' => 2048, @@ -89,19 +88,19 @@ public function buildForm(array $form, array &$form_state, FilterFormat $filter_ } $form['attributes']['alt'] = array( - '#title' => t('Alternative text'), + '#title' => $this->t('Alternative text'), '#type' => 'textfield', '#default_value' => isset($input['alt']) ? $input['alt'] : '', '#maxlength' => 2048, ); $form['dimensions'] = array( '#type' => 'item', - '#title' => t('Image size'), + '#title' => $this->t('Image size'), '#field_prefix' => '
', '#field_suffix' => '
', ); $form['dimensions']['width'] = array( - '#title' => t('Width'), + '#title' => $this->t('Width'), '#title_display' => 'invisible', '#type' => 'number', '#default_value' => isset($input['width']) ? $input['width'] : '', @@ -114,7 +113,7 @@ public function buildForm(array $form, array &$form_state, FilterFormat $filter_ '#parents' => array('attributes', 'width'), ); $form['dimensions']['height'] = array( - '#title' => t('Height'), + '#title' => $this->t('Height'), '#title_display' => 'invisible', '#type' => 'number', '#default_value' => isset($input['height']) ? $input['height'] : '', @@ -132,7 +131,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( @@ -147,12 +146,6 @@ public function buildForm(array $form, array &$form_state, FilterFormat $filter_ /** * {@inheritdoc} */ - public function validateForm(array &$form, array &$form_state) { - } - - /** - * {@inheritdoc} - */ public function submitForm(array &$form, array &$form_state) { $response = new AjaxResponse(); diff --git a/core/modules/editor/lib/Drupal/editor/Form/EditorLinkDialog.php b/core/modules/editor/lib/Drupal/editor/Form/EditorLinkDialog.php index e796687..c2c17e1 100644 --- a/core/modules/editor/lib/Drupal/editor/Form/EditorLinkDialog.php +++ b/core/modules/editor/lib/Drupal/editor/Form/EditorLinkDialog.php @@ -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( @@ -78,12 +78,6 @@ public function buildForm(array $form, array &$form_state, FilterFormat $filter_ /** * {@inheritdoc} */ - public function validateForm(array &$form, array &$form_state) { - } - - /** - * {@inheritdoc} - */ public function submitForm(array &$form, array &$form_state) { $response = new AjaxResponse();