Problem/Motivation
If adding/selecting media fails (e.g. due to a validation error), the module still renders the “Decorative” checkbox and an additional container intended for error output. In setups where another module (for example filehash) also provides an error message container, the same validation message can be displayed twice. This results in confusing and noisy error feedback for editors.
Steps to reproduce
- Enable the module and add a media/image field that uses the widget where the “Decorative” checkbox is rendered.
- Enable another module that adds validation errors for files (e.g.
filehash/ dedupe validation). - Try to add/upload a media item that triggers a validation error (so the file is not accepted/attached).
- Observe that the validation error is rendered twice.
Proposed resolution
Only add/render the “Decorative” checkbox (and its wrapper/error container) when a file/media item was actually accepted and attached to the field widget. If the upload/selection fails and no valid file is present, the checkbox should not be rendered to avoid creating an extra error container and prevent duplicate error output.
Issue fork decorative_images-3571199
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
gashunk commentedComment #4
ll66382 commentedThank you for identifying the issue, and for a proposed solution. I expect to test tomorrow or Saturday.
Comment #7
ll66382 commented