- Issue created by @afoerster
Do you mean this worked in Drupal 10.2.3 and broke in 10.2.4 specifically? If "yes", is 🐛 Field block for empty image field with no default image rendering empty div in Layout Builder Fixed the reason?
- Status changed to Postponed: needs info
8 months ago 10:35pm 25 March 2024 - 🇳🇿New Zealand danielveza Brisbane, AU
Does the same issue exist if you follow the steps to replicate with just Drupal core?
It may be an issue with the module you have linked rather than core itself.
I created the layout with 10.2.2, updated to 10.2.3 (still working) and after update to 10.2.4 it broke.
The steps to reproduce contain the minimum steps to reproduce the problem, the mentioned module is not necessary.I tried to revert the changes introduced in #3398196 and it started working again.
The issue with contrib module Config default image → appears to be separate from the issue with default image in core. The only relation being they were both surfaced by the fix in 🐛 Field block for empty image field with no default image rendering empty div in Layout Builder Fixed .
Briefly about the contrib module: it allows users to set a default image path with the field formatter. Since the default value on the field item is detected to be empty (no uuid), the field formatter is never invoked. An issue for that module probably needs to be opened to address.
Addressing the core issue here: Image field items can have a default image set at the storage level (so for all instances on the entity type) and at the bundle level. Using a standard 11.x install with Layout Builder, if I edit the User Picture field settings and set a default image on the field storage, then the image does not appear. However, if I set the default image on the instance (lower down on the form - see screenshot), then image does appear. My assumption is that when
$field->getFieldDefinition()->getSetting('default_image')['uuid'])
is called, at the very least, thedefault_image
is not properly merged between the field storage setting and the field instance setting.- Merge request !7197Issue #3435906: Account for default image on field storage. → (Closed) created by godotislate
- Status changed to Needs review
8 months ago 12:19am 27 March 2024 Updated the default value detection for image fields to account for field storage settings. It's largely copied from
Drupal\image\Plugin\Field\FieldFormatter\ImageFormatterBase::getEntitiesToView()
. Also updated tests.- Status changed to RTBC
8 months ago 12:13am 30 March 2024 - 🇺🇸United States smustgrave
Test-only feature does show the issue
1) Drupal\Tests\layout_builder\Functional\LayoutBuilderDefaultValuesTest::testDefaultValues Behat\Mink\Exception\ResponseTextException: The text "field_image_storage_default" was not found anywhere in the text of the current page. /builds/issue/drupal-3435906/vendor/behat/mink/src/WebAssert.php:907 /builds/issue/drupal-3435906/vendor/behat/mink/src/WebAssert.php:293 /builds/issue/drupal-3435906/core/tests/Drupal/Tests/WebAssert.php:956 /builds/issue/drupal-3435906/core/modules/layout_builder/tests/src/Functional/LayoutBuilderDefaultValuesTest.php:192 /builds/issue/drupal-3435906/core/modules/layout_builder/tests/src/Functional/LayoutBuilderDefaultValuesTest.php:114 /builds/issue/drupal-3435906/vendor/phpunit/phpunit/src/Framework/TestResult.php:728 ERRORS! Tests: 1, Assertions: 7, Errors: 1.
For my testing I used https://www.drupal.org/project/moderation_dashboard → to get the layout builder for user display (too lazy to manually create). I added a new field image with a default. And placed within the dashboard. Belive I did see the issue and the patch does appear to address the issue.
As this is a regression going to mark now so hopefully can be fixed in next release.
- 🇬🇧United Kingdom alexpott 🇪🇺🌍
The double default stuff is a mess, but this fix at least is consistent.
Committed and pushed 3cf0c074d0 to 11.x and a365535543 to 10.3.x and 2839eeca7e to 10.2.x. Thanks!
-
alexpott →
committed 2839eeca on 10.2.x
Issue #3435906 by godotislate, afoerster: Default Images not rendered in...
-
alexpott →
committed 2839eeca on 10.2.x
-
alexpott →
committed a3655355 on 10.3.x
Issue #3435906 by godotislate, afoerster: Default Images not rendered in...
-
alexpott →
committed a3655355 on 10.3.x
- Status changed to Fixed
8 months ago 11:04am 30 March 2024 -
alexpott →
committed 3cf0c074 on 11.x
Issue #3435906 by godotislate, afoerster: Default Images not rendered in...
-
alexpott →
committed 3cf0c074 on 11.x
Automatically closed - issue fixed for 2 weeks with no activity.