Problem/Motivation

The image effect form provides a `background_style_dominant` setting with options `single_color` and `gradient`.

However, `applyEffect()` checks `$this->configuration['background_style']` when `background_type` is `dominant_color`:

if ($background_style == 'gradient') {
  $this->applyGradientBackground($image, $background, $gradient_direction);
}
else {
  $this->applyDominantColorBackground($image, $background);
}

The submit handler also saves a misspelled key:

$this->configuration['background_style_dominent'] = $form_state->getValue('background_style');

Because of this, selecting the gradient option for dominant color does not drive the rendering logic.

Steps to reproduce

1. Enable `image_scale_fill`.
2. Create or edit an image style.
3. Add the `Scale and Fill Background` effect.
4. Set `Background Type` to `Dominant Color`.
5. Set the dominant color background style to `Gradient`.
6. Save the image style.
7. Generate an image derivative using that style.

Actual result

The gradient option is not applied as expected because the effect reads/saves the wrong configuration key.

Expected result

When `Dominant Color` + `Gradient` is selected, the generated derivative should use the gradient background.

Proposed resolution

Use the same key consistently:

$this->configuration['background_style_dominant'] = $form_state->getValue('background_style_dominant');

And in `applyEffect()`, check `background_style_dominant` for the `dominant_color` background type.

Comments

dkmishra created an issue. See original summary.

  • vimaljoseph committed 3768fd20 on 1.0.x
    Issue #3608768 by dkmishra: Fix configuration key for dominant color...
vimaljoseph’s picture

Status: Active » Fixed

Committed to 1.0.x (1.0.x-dev). Thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.