diff --git a/core/modules/image/lib/Drupal/image/Form/ImageEffectAddForm.php b/core/modules/image/lib/Drupal/image/Form/ImageEffectAddForm.php index 1d644e6c166a59bb7ba6844af9bd74c1ee55c34d..7696b23777724a62a01c37f554e37a3114cab296 100644 --- a/core/modules/image/lib/Drupal/image/Form/ImageEffectAddForm.php +++ b/core/modules/image/lib/Drupal/image/Form/ImageEffectAddForm.php @@ -11,7 +11,6 @@ use Drupal\image\ImageEffectManager; use Drupal\image\ImageStyleInterface; use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\HttpFoundation\Request; /** * Provides an add form for image effects. @@ -47,11 +46,11 @@ public static function create(ContainerInterface $container) { /** * {@inheritdoc} */ - public function buildForm(array $form, array &$form_state, Request $request = NULL, ImageStyleInterface $image_style = NULL, $image_effect = NULL) { - $form = parent::buildForm($form, $form_state, $request, $image_style, $image_effect); + public function buildForm(array $form, array &$form_state, ImageStyleInterface $image_style = NULL, $image_effect = NULL) { + $form = parent::buildForm($form, $form_state, $image_style, $image_effect); - drupal_set_title(t('Add %label effect', array('%label' => $this->imageEffect->label())), PASS_THROUGH); - $form['actions']['submit']['#value'] = t('Add effect'); + $form['#title'] = $this->t('Add %label effect', array('%label' => $this->imageEffect->label())); + $form['actions']['submit']['#value'] = $this->t('Add effect'); return $form; } diff --git a/core/modules/image/lib/Drupal/image/Form/ImageEffectDeleteForm.php b/core/modules/image/lib/Drupal/image/Form/ImageEffectDeleteForm.php index c3a99ed2341a2cc660c5a3846ed0501f368c4948..5e8b762d2723338855e1a59720315dcd46cd8c32 100644 --- a/core/modules/image/lib/Drupal/image/Form/ImageEffectDeleteForm.php +++ b/core/modules/image/lib/Drupal/image/Form/ImageEffectDeleteForm.php @@ -33,14 +33,14 @@ class ImageEffectDeleteForm extends ConfirmFormBase { * {@inheritdoc} */ public function getQuestion() { - return t('Are you sure you want to delete the @effect effect from the %style style?', array('%style' => $this->imageStyle->label(), '@effect' => $this->imageEffect->label())); + return $this->t('Are you sure you want to delete the @effect effect from the %style style?', array('%style' => $this->imageStyle->label(), '@effect' => $this->imageEffect->label())); } /** * {@inheritdoc} */ public function getConfirmText() { - return t('Delete'); + return $this->t('Delete'); } /** @@ -72,7 +72,7 @@ public function buildForm(array $form, array &$form_state, ImageStyleInterface $ */ public function submitForm(array &$form, array &$form_state) { $this->imageStyle->deleteImageEffect($this->imageEffect); - drupal_set_message(t('The image effect %name has been deleted.', array('%name' => $this->imageEffect->label()))); + drupal_set_message($this->t('The image effect %name has been deleted.', array('%name' => $this->imageEffect->label()))); $form_state['redirect'] = 'admin/config/media/image-styles/manage/' . $this->imageStyle->id(); } diff --git a/core/modules/image/lib/Drupal/image/Form/ImageEffectEditForm.php b/core/modules/image/lib/Drupal/image/Form/ImageEffectEditForm.php index 57fda1638f57097e0c92d6cda8e6950a5ea7c36e..f949e6c825c7e5a5a8365c7c18fbe3eee74650f0 100644 --- a/core/modules/image/lib/Drupal/image/Form/ImageEffectEditForm.php +++ b/core/modules/image/lib/Drupal/image/Form/ImageEffectEditForm.php @@ -8,7 +8,6 @@ namespace Drupal\image\Form; use Drupal\image\ImageStyleInterface; -use Symfony\Component\HttpFoundation\Request; /** * Provides an edit form for image effects. @@ -18,11 +17,11 @@ class ImageEffectEditForm extends ImageEffectFormBase { /** * {@inheritdoc} */ - public function buildForm(array $form, array &$form_state, Request $request = NULL, ImageStyleInterface $image_style = NULL, $image_effect = NULL) { - $form = parent::buildForm($form, $form_state, $request, $image_style, $image_effect); + public function buildForm(array $form, array &$form_state, ImageStyleInterface $image_style = NULL, $image_effect = NULL) { + $form = parent::buildForm($form, $form_state, $image_style, $image_effect); - drupal_set_title(t('Edit %label effect', array('%label' => $this->imageEffect->label())), PASS_THROUGH); - $form['actions']['submit']['#value'] = t('Update effect'); + $form['#title'] = $this->t('Edit %label effect', array('%label' => $this->imageEffect->label())); + $form['actions']['submit']['#value'] = $this->t('Update effect'); return $form; } diff --git a/core/modules/image/lib/Drupal/image/Form/ImageEffectFormBase.php b/core/modules/image/lib/Drupal/image/Form/ImageEffectFormBase.php index 705dad3bb920d4d4bbe5d1f7983dbef6fe5a6592..308331eca407733acb3ff85346868c4efc212479 100644 --- a/core/modules/image/lib/Drupal/image/Form/ImageEffectFormBase.php +++ b/core/modules/image/lib/Drupal/image/Form/ImageEffectFormBase.php @@ -7,17 +7,15 @@ namespace Drupal\image\Form; -use Drupal\Core\Form\FormInterface; +use Drupal\Core\Form\FormBase; use Drupal\image\ConfigurableImageEffectInterface; use Drupal\image\ImageStyleInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** * Provides a base form for image effects. */ -abstract class ImageEffectFormBase implements FormInterface { +abstract class ImageEffectFormBase extends FormBase { /** * The image style. @@ -43,8 +41,6 @@ public function getFormID() { /** * {@inheritdoc} * - * @param \Symfony\Component\HttpFoundation\Request $request - * The current request. * @param \Drupal\image\ImageStyleInterface $image_style * The image style. * @param string $image_effect @@ -55,9 +51,10 @@ public function getFormID() { * * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ - public function buildForm(array $form, array &$form_state, Request $request = NULL, ImageStyleInterface $image_style = NULL, $image_effect = NULL) { + public function buildForm(array $form, array &$form_state, ImageStyleInterface $image_style = NULL, $image_effect = NULL) { $this->imageStyle = $image_style; $this->imageEffect = $this->prepareImageEffect($image_effect); + $request = $this->getRequest(); if (!($this->imageEffect instanceof ConfigurableImageEffectInterface)) { throw new NotFoundHttpException(); @@ -89,18 +86,12 @@ public function buildForm(array $form, array &$form_state, Request $request = NU ); $form['actions']['cancel'] = array( '#type' => 'link', - '#title' => t('Cancel'), + '#title' => $this->t('Cancel'), '#href' => 'admin/config/media/image-styles/manage/' . $this->imageStyle->id(), ); return $form; } - /** - * {@inheritdoc} - */ - public function validateForm(array &$form, array &$form_state) { - } - /** * {@inheritdoc} */ @@ -108,7 +99,7 @@ public function submitForm(array &$form, array &$form_state) { form_state_values_clean($form_state); $this->imageStyle->saveImageEffect($form_state['values']); - drupal_set_message(t('The image effect was successfully applied.')); + drupal_set_message($this->t('The image effect was successfully applied.')); $form_state['redirect'] = 'admin/config/media/image-styles/manage/' . $this->imageStyle->id(); } diff --git a/core/modules/image/lib/Drupal/image/Form/ImageStyleDeleteForm.php b/core/modules/image/lib/Drupal/image/Form/ImageStyleDeleteForm.php index 681add90b541315f934430c66a9cb8d64ad47e86..315fdef43629e51f7dde0b4f3fc495a2948480f9 100644 --- a/core/modules/image/lib/Drupal/image/Form/ImageStyleDeleteForm.php +++ b/core/modules/image/lib/Drupal/image/Form/ImageStyleDeleteForm.php @@ -18,14 +18,14 @@ class ImageStyleDeleteForm extends EntityConfirmFormBase { * {@inheritdoc} */ public function getQuestion() { - return t('Optionally select a style before deleting %style', array('%style' => $this->entity->label())); + return $this->t('Optionally select a style before deleting %style', array('%style' => $this->entity->label())); } /** * {@inheritdoc} */ public function getConfirmText() { - return t('Delete'); + return $this->t('Delete'); } /** @@ -39,7 +39,7 @@ public function getCancelPath() { * {@inheritdoc} */ public function getDescription() { - return t('If this style is in use on the site, you may select another style to replace it. All images that have been generated for this style will be permanently deleted.'); + return $this->t('If this style is in use on the site, you may select another style to replace it. All images that have been generated for this style will be permanently deleted.'); } /** @@ -48,10 +48,10 @@ public function getDescription() { public function form(array $form, array &$form_state) { $replacement_styles = array_diff_key(image_style_options(), array($this->entity->id() => '')); $form['replacement'] = array( - '#title' => t('Replacement style'), + '#title' => $this->t('Replacement style'), '#type' => 'select', '#options' => $replacement_styles, - '#empty_option' => t('No replacement, just delete'), + '#empty_option' => $this->t('No replacement, just delete'), ); return parent::form($form, $form_state); @@ -63,7 +63,7 @@ public function form(array $form, array &$form_state) { public function submit(array $form, array &$form_state) { $this->entity->set('replacementID', $form_state['values']['replacement']); $this->entity->delete(); - drupal_set_message(t('Style %name was deleted.', array('%name' => $this->entity->label()))); + drupal_set_message($this->t('Style %name was deleted.', array('%name' => $this->entity->label()))); $form_state['redirect'] = 'admin/config/media/image-styles'; }