ImageItem::defaultStorageSettings should override display_default

Created on 17 March 2025, 18 days ago

Problem/Motivation

The value is always set to TRUE in \Drupal\file\Plugin\Field\FieldWidget\FileWidget::process (line 411) and causes invalid values from FormState::getValues after calling FormBuilder::buildForm if the form isn't submitted

Steps to reproduce

Create an entity form with an image widget
Call buildForm on the form builder for that form and inspect $form_state->getValue(['your_field_name', 0, 'display']) and note it will be FALSE despite the value being hard-coded to 1 in \Drupal\file\Plugin\Field\FieldWidget\FileWidget::process

Proposed resolution

Override ::defaultStorageSettings for ImageItem and set display_default to TRUE

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Active

Version

11.0 🔥

Component

image.module

Created by

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

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