Incompatibility with Inline Form Errors

Created on 13 June 2025, 12 days ago

Problem/Motivation

When Inline Form Errors is installed and the file uploaded with the "image_library_widget" does not validate, the user will see the usual "1 error has been found" message with an anchor link to the element, but:

  1. The actual error message is not rendered anywhere on the page.
  2. The anchor seems to be broken (it refers an unused HTML ID / name). This issue also exists in the core widgets, but it would be nice to fix it as well in this project.

The reason is that template_preprocess_form_element() is invoked manually in template_preprocess__image_library_widget(), but at the time when the prepreocessed variables reach
template_preprocess__image_library_widget(), they are already processed by template_preprocess_form_element().

Steps to reproduce

See the test I add(ed) to the MR.

  1. Set up this widget at an image field.
  2. Limit the allowed extensions to e.g. txt
  3. Disable JavaScript interpreter so Drupal.file.validateExtension() won't jump in.
  4. Limit the allowed extensions to e.g. txt
  5. With Inline Entity Form installed, visit the form having the image field configured and try to upload a png file.

Proposed resolution

Do not call template_preprocess_form_element() manually in template_preprocess__image_library_widget(). Instead, register `form_element__image_library_widget` theme function as a derivative of `form_element`.

Remaining tasks

User interface changes

Inline form error message appears.

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡­πŸ‡ΊHungary huzooka Hungary πŸ‡­πŸ‡ΊπŸ‡ͺπŸ‡Ί

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024