Issue #3223233 by joachim, danflanagan8, longwave: Form to edit or add a single image effect doesn't tell you which style you're in

merge-requests/454/merge
Cristina Chumillas 2021-11-12 16:13:42 +01:00
parent 9d75e740c6
commit 8a4928c160
3 changed files with 12 additions and 2 deletions

View File

@ -46,7 +46,10 @@ class ImageEffectAddForm extends ImageEffectFormBase {
public function buildForm(array $form, FormStateInterface $form_state, ImageStyleInterface $image_style = NULL, $image_effect = NULL) {
$form = parent::buildForm($form, $form_state, $image_style, $image_effect);
$form['#title'] = $this->t('Add %label effect', ['%label' => $this->imageEffect->label()]);
$form['#title'] = $this->t('Add %label effect to style %style', [
'%label' => $this->imageEffect->label(),
'%style' => $image_style->label(),
]);
$form['actions']['submit']['#value'] = $this->t('Add effect');
return $form;

View File

@ -18,7 +18,10 @@ class ImageEffectEditForm extends ImageEffectFormBase {
public function buildForm(array $form, FormStateInterface $form_state, ImageStyleInterface $image_style = NULL, $image_effect = NULL) {
$form = parent::buildForm($form, $form_state, $image_style, $image_effect);
$form['#title'] = $this->t('Edit %label effect', ['%label' => $this->imageEffect->label()]);
$form['#title'] = $this->t('Edit %label effect on style %style', [
'%label' => $this->imageEffect->label(),
'%style' => $image_style->label(),
]);
$form['actions']['submit']['#value'] = $this->t('Update effect');
return $form;

View File

@ -140,6 +140,8 @@ class ImageAdminStylesTest extends ImageFieldTestBase {
$this->drupalGet($style_path);
$this->submitForm(['new' => $effect], 'Add');
if (!empty($edit)) {
$effect_label = \Drupal::service('plugin.manager.image.effect')->createInstance($effect)->label();
$this->assertSession()->pageTextContains("Add {$effect_label} effect to style {$style_label}");
$this->submitForm($edit_data, 'Add effect');
}
}
@ -391,6 +393,7 @@ class ImageAdminStylesTest extends ImageFieldTestBase {
// There should normally be only one edit link on this page initially.
$this->clickLink('Edit');
$this->assertSession()->pageTextContains("Edit Scale and crop effect on style Test style effect edit");
$this->submitForm(['data[width]' => '360', 'data[height]' => '240'], 'Update effect');
$this->assertSession()->pageTextContains('Scale and crop 360×240');
@ -405,6 +408,7 @@ class ImageAdminStylesTest extends ImageFieldTestBase {
// Edit the scale effect that was just added.
$this->clickLink('Edit');
$this->assertSession()->pageTextContains("Edit Scale effect on style Test style scale edit scale");
$this->submitForm(['data[width]' => '24', 'data[height]' => '19'], 'Update effect');
// Add another scale effect and make sure both exist. Click through from