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

Created on 27 September 2022, over 2 years ago
Updated 14 September 2023, over 1 year 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.71.5 2024