Fix Warning: Undefined array key "iwc" in the settings Summary method from the DrImage Formatter class

Created on 27 September 2022, almost 2 years ago
Updated 14 September 2023, 10 months ago

Problem/Motivation

Having the following

Warning: Undefined array key "iwc" in Drupal\drimage\Plugin\Field\FieldFormatter\DrImageFormatter->settingsSummary() (line 212 of modules/contrib/drimage/src/Plugin/Field/FieldFormatter/DrImageFormatter.php).
Drupal\drimage\Plugin\Field\FieldFormatter\DrImageFormatter->settingsSummary() (Line: 431)

Steps to reproduce

Given that the Drimage module was enabled and configured in a Drupal 9.4.x site
And the "image_widget_crop" module was enabled
And a number of Media Displays were configured to use the Drimage formatter
And the "image_widget_crop" was disabled or removed from the site
And the "All messages, with backtrace information" was selected in the "Error messages to display" configurations in the site
When navigating to "admin/structure/media/manage/image/display"
Then the Warning will show up on the admin page

Proposed resolution

Have a pre-check before using the "iwc" in case the image handling options did not have

When the Media Display is using image_handling: aspect_ratio or image_handling: background
not "image_handling: iwc"

The change of values when enabled

      iwc:
        image_style: ''

when not enabled

      iwc:
        image_style: null

Remaining tasks

  • βœ… File an issue
  • βž– Addition/Change/Update/Fix
  • βž– Merge request, Patch, or Commit
  • βž– Testing to ensure no regression
  • βž– Automated unit testing coverage
  • βž– Automated functional testing coverage
  • βž– UX/UI designer responsibilities
  • βž– Readability
  • βž– Accessibility
  • βž– Performance
  • βž– Security
  • βž– Documentation
  • βž– Code review by maintainers
  • βž– Full testing and approval
  • βž– Credit contributors
  • βž– Review with the product owner
  • βž– Release notes snippet
  • ❌ Release

User interface changes

  • N/A

API changes

  • N/A

Data model changes

  • N/A
πŸ› Bug report
Status

Closed: outdated

Version

2.0

Component

Code

Created by

πŸ‡―πŸ‡΄Jordan Rajab Natshah Jordan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡§πŸ‡ͺBelgium weseze

    Closing because this ticket has become stale and outdated. Feel free to reopen if this is stil an issue thad needs fixing.

  • πŸ‡―πŸ‡΄Jordan Rajab Natshah Jordan

    I agree to that.
    This could be changed from the template of default configs.
    Sorry, I had no time to add a fix for the the auto cleanup process.
    Maybe, Later for sure.

Production build 0.69.0 2024