FileUploadHelp preprocessor was broken by Core's change to constraint plugins

Created on 2 January 2024, almost 2 years ago
Updated 5 July 2024, over 1 year ago

After updating to Drupal Core 10.2.0 the file upload size and allowed file type constraints disappeared from the "Upload requirements" dropdown under File field widgets. This is the result of a change to Core's file validation and constraint plugin system, see the change record at https://www.drupal.org/node/3363700 โ†’ and its subsection on "Form API changes."

As described in the change record, the render array keys that contain the constraint information have changed. The preprocessor class needs to be updated to check for these new keys. It should be possible to do this in a backward-compatible way by checking for both the old and new keys.

Steps to reproduce:

  1. Install Bootstrap.
  2. Either set Bootstrap to be the admin theme or in the Appearance admin settings uncheck the box to "Use the administration theme when editing or creating content."
  3. Add a file field to any content type. Constrain the field to one or more file types. The default Article type with its Image field works.
  4. View the form for adding or editing the content type.
  5. Click the "Upload requirements" link under the file field widget.

Expected result:
The upload requirements should display the cardinality, file upload size limit, and required file types.

Actual result:
The upload requirements only displays the cardinality.

๐Ÿ› Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States dcam

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