- ivnish Kazakhstan
I implemented this. Don't work with existing fields. Needs to remove image field from content type and add again
- Status changed to Needs work
over 1 year ago 3:13pm 27 October 2023 - 🇺🇸United States smustgrave
Thanks for working on this old issue!
Will need test coverage and upgrade path for existing fields.
UI changes should have before/after screenshots added to issue summary.
Got the issue summary started but will need updating
- last update
over 1 year ago Patch Failed to Apply - last update
over 1 year ago 30,386 pass, 33 fail - last update
over 1 year ago Custom Commands Failed - last update
over 1 year ago Patch Failed to Apply - last update
over 1 year ago Custom Commands Failed - last update
over 1 year ago 29,576 pass, 31 fail - Merge request !7251Add an Include image in display checkbox to the image field → (Open) created by ivnish
- Assigned to ivnish
- ivnish Kazakhstan
Change record draft created https://www.drupal.org/node/3468525 →
- Issue was unassigned.
- Status changed to Needs review
8 months ago 11:48am 16 August 2024 - 🇮🇳India prashant.c Dharamshala
While reviewing this you need to run database updates by visiting
/update.php
or withdrush updb
Module Update ID Type Description -------- ---------------------- ------------- --------------------------------------------------------- image add_display_checkbox post-update Add a table column for "Enable Display field" checkbox.
otherwise you will get this error
The website encountered an unexpected error. Try again later. Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'field_image_display' in 'where clause': SELECT 1 AS "expression" FROM "node_revision__field_image" "t" WHERE ("field_image_target_id" IS NOT NULL) OR ("field_image_display" IS NOT NULL) OR ("field_image_alt" IS NOT NULL) OR ("field_image_title" IS NOT NULL) OR ("field_image_width" IS NOT NULL) OR ("field_image_height" IS NOT NULL) LIMIT 1 OFFSET 0; Array ( ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->countFieldData() (line 1789 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
The changes are working as expected, now we have the additional checkboxes in the image field settings to display the file.
Steps to test:
- Run database updates using drush or from update.php file
- In the content type or any other entity type add an Image field or edit any existing image field
- In the field settings you will find the checkboxes shown in the attached screenshots
- 🇺🇸United States smustgrave
Update hook does not appear to work.
I ran it and did a drush cex and nothing was updated
Went into admin/structure/media/manage/image/fields and resaved the field (made 0 changes)
And get new config keys.Probably will need to update all image config that ships with core also.
- Status changed to Needs work
8 months ago 2:54pm 17 August 2024 - ivnish Kazakhstan
@smustgrave I tested again and there are results. Needs to view Drupal Status page
1) Before patch there are no errors/warnings about any field
2) After the patch there are errors about fields
3) After updb there are no errors/warnings about any field
Config export still has no changes
- ivnish Kazakhstan
We don't have any changes in configs because Image Storage ALREADY has display property in config (extended from File)
- ivnish Kazakhstan
@smustgrave do we need upgrade path tests if config doesn't change?
- Status changed to Needs review
8 months ago 7:51am 18 August 2024 - 🇺🇸United States smustgrave
I definitely seemed to get config changes after applying the MR. Not from the update hook but from just resaving a field form.
- ivnish Kazakhstan
@smustgrave you are right, but config updated "default image uuid". It is not my patch issue. I installed clean Drupal instance, applied a patch and exported configs. I re-saved the article image field form and exported configs again. Then I compared configs.
See screenshots
- 🇺🇸United States smustgrave
Did you try
Fresh install
Export config
Apply patch
Save field
Export again? - 🇮🇳India prashant.c Dharamshala
@smustgrave in #47 you mean resaving the field by checking the checkbox or without any changes?
- I tested it and on just resaving the image field there are no config changes in my case either.
- By checking the checkbox, it will have a config change as the value is changing to TRUE
display_default: true
The Needs Review Queue Bot → tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide → to find step-by-step guides for working with issues.
- Status changed to RTBC
4 months ago 9:50pm 10 December 2024 - 🇬🇧United Kingdom longwave UK
It seems this was a deliberate choice at some point, from
ImageItem::isDisplayed()
:// Image items do not have per-item visibility settings.
This was added in #2090619: Move file visibility check to the FileItem class → but there was no discussion that I can find as to why image items should not have this setting.
However, I'm not really sure how useful this feature is. Aren't images meant to be displayed?
- 🇧🇾Belarus krakenbite
However, I'm not really sure how useful this feature is. Aren't images meant to be displayed?
Yes! This is useful feature for some sites. I'm using it on my Drupal 6 projects and want to use on Drupal 10+ after migration
- 🇧🇷Brazil pfeiffer
I created a patch file with the diff of the PR to be more secure to use as a patch
- 🇧🇷Brazil pfeiffer
I tested the PR in a Drupal 11.1.0 and now I have the option for enabling the display control done by each node.
Everything is working and no errors were logged, nice work!
Editing a node:
Editing the field:
- ivnish Kazakhstan
@larowlan these tests are tests from File module (with some small changes). They working fine there and here :) Do we really need to modify it?
- 🇺🇸United States dillix
@longwave @larowlan this cool feature and for some reason it was removed from Image module, although the module File has it (looks like regression)
- Status changed to Needs work
about 1 month ago 11:37am 20 February 2025 - 🇸🇰Slovakia Letha
Hi, I tried applying the patch, but update.php didn't run successfully even after multiple attempts, without displaying any specific error.
Is there a reason why it is placed in post_update instead of as an update in the install file? (I tried moving it to the install file, and it seems that the update.php ran fine.)
- ivnish Kazakhstan
Hi @letha post_update is a requirement of drupal core
Do you have any errors in drupal log ?
- 🇸🇰Slovakia Letha
Oh, good to know, thanks :)
Regarding the log, I only see an error that appears when I click on "Continue to the error page" :
TypeError: Drupal\Component\Utility\Html::escape(): Argument #1 ($text) must be of type string, null given, called in C:\xampp83\htdocs\unipo\core\lib\Drupal\Component\Render\FormattableMarkup.php on line 238 in Drupal\Component\Utility\Html::escape() (line 431 of C:\xampp83\htdocs\unipo\core\lib\Drupal\Component\Utility\Html.php)
#0 C:\xampp83\htdocs\unipo\core\lib\Drupal\Component\Render\FormattableMarkup.php(238): Drupal\Component\Utility\Html::escape(NULL)
#1 C:\xampp83\htdocs\unipo\core\lib\Drupal\Component\Render\FormattableMarkup.php(187): Drupal\Component\Render\FormattableMarkup::placeholderEscape(NULL)
#2 C:\xampp83\htdocs\unipo\core\lib\Drupal\Core\StringTranslation\TranslatableMarkup.php(195): Drupal\Component\Render\FormattableMarkup::placeholderFormat('The update proc...', Array)
#3 C:\xampp83\htdocs\unipo\core\lib\Drupal\Component\Utility\ToStringTrait.php(15): Drupal\Core\StringTranslation\TranslatableMarkup->render()
#4 C:\xampp83\htdocs\unipo\core\modules\system\src\Controller\DbUpdateController.php(440): Drupal\Core\StringTranslation\TranslatableMarkup->__toString()
#5 C:\xampp83\htdocs\unipo\core\modules\system\src\Controller\DbUpdateController.php(193): Drupal\system\Controller\DbUpdateController->results(Object(Symfony\Component\HttpFoundation\Request))
#6 [internal function]: Drupal\system\Controller\DbUpdateController->handle('results', Object(Symfony\Component\HttpFoundation\Request))
#7 C:\xampp83\htdocs\unipo\core\lib\Drupal\Core\Update\UpdateKernel.php(115): call_user_func_array(Array, Array)
#8 C:\xampp83\htdocs\unipo\core\lib\Drupal\Core\Update\UpdateKernel.php(76): Drupal\Core\Update\UpdateKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request))
#9 C:\xampp83\htdocs\unipo\update.php(27): Drupal\Core\Update\UpdateKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#10 {main}Warning: Undefined array key 1 in Drupal\system\Controller\DbUpdateController->results() (line 437 of C:\xampp83\htdocs\unipo\core\modules\system\src\Controller\DbUpdateController.php)
#0 C:\xampp83\htdocs\unipo\core\includes\bootstrap.inc(108): _drupal_error_handler_real(2, 'Undefined array...', 'C:\\xampp83\\htdo...', 437)
#1 C:\xampp83\htdocs\unipo\core\modules\system\src\Controller\DbUpdateController.php(437): _drupal_error_handler(2, 'Undefined array...', 'C:\\xampp83\\htdo...', 437)
#2 C:\xampp83\htdocs\unipo\core\modules\system\src\Controller\DbUpdateController.php(193): Drupal\system\Controller\DbUpdateController->results(Object(Symfony\Component\HttpFoundation\Request))
#3 [internal function]: Drupal\system\Controller\DbUpdateController->handle('results', Object(Symfony\Component\HttpFoundation\Request))
#4 C:\xampp83\htdocs\unipo\core\lib\Drupal\Core\Update\UpdateKernel.php(115): call_user_func_array(Array, Array)
#5 C:\xampp83\htdocs\unipo\core\lib\Drupal\Core\Update\UpdateKernel.php(76): Drupal\Core\Update\UpdateKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request))
#6 C:\xampp83\htdocs\unipo\update.php(27): Drupal\Core\Update\UpdateKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#7 {main}Nothing else really. Update.php ends with "An unrecoverable error has occurred." and "An AJAX HTTP request terminated abnormally. " but nothing in browser's developer console or any other information that could provide a clue.
- 🇸🇰Slovakia Letha
Found the problem! It was caused by PHP 8.3 and the deprecated assert.active directive ( https://www.drupal.org/project/drupal/issues/3398033 📌 Remove mentions of assert.active from .htaccess Needs work ). Sorry for the confusion.
- 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10
This is actually causing a bug in experience builder because the default value set in the file widget is drawn from the field setting but ImageItem doesn't correctly change the default 📌 Media Library dialogs triggered from page data do not have buttons yet Active