Problem/Motivation
Getting Error on file usage page for default image uploaded on image field.
Steps to reproduce
- Upload and set default image for any field.
- Check the files in the admin/content/files page
- Click the file usage link for the file. the page getting 500 Error
Drupal\Component\Plugin\Exception\PluginNotFoundException: The "default_image" entity type does not exist. in Drupal\Core\Entity\EntityTypeManager->getDefinition() (line 139 of /app/docroot/core/lib/Drupal/Core/Entity/EntityTypeManager.php).
Proposed resolution
- Add a check in "Drupal\views\Plugin\views\field\EntityLabel"'s preRender method to ensure that entity type manager has plugin definition
Remaining tasks
- Update PR with latest 11.x
- Change PR destination to point to 11.x instead of 10.2.x
User interface changes
N/A
API changes
N/A
Data model changes
N/A
Release notes snippet
N/A
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | D-11_AfterMR.png | 36.14 KB | kanchan bhogade |
| #16 | D-11_BeforeMR.png | 261.72 KB | kanchan bhogade |
| #16 | D-10_AfterMR.png | 36.18 KB | kanchan bhogade |
| #16 | D-10_BeforeMR.png | 282.4 KB | kanchan bhogade |
Issue fork drupal-3442346
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3442346-11-x
changes, plain diff MR !7752
- 3442346-default-image-usage
changes, plain diff MR !7660
Comments
Comment #2
larowlanCan you turn on verbose error reporting from admin/config/development/logging and provide the full stack trace? Thanks
Comment #3
leopathu commentedHere is the Logs info
Comment #4
mingsongI couldn't reproduce this error by the following steps on a Drupal 10.2.5 site:
Comment #5
leopathu commented@Mingsong It is happening only for default image uploaded on image fields.
For example: Set a default image for any image field. and see the image file usage in the admin/content/files page. then you can get it.
Comment #6
larowlanThis looks like the views entity label plugin on this view is conflating the file usage type with an entity type
The call to getStorage needs to check hasDefinition first
Comment #8
mingsongA new test to reproduce this error in 10.2.x branch.
https://git.drupalcode.org/project/drupal/-/merge_requests/7660/diffs
Comment #9
mingsongComment #11
mohit_aghera commented@Mingsong can you please update the PR with latest 11.x and change the destination for 11.x
I've pushed the fix on the branch.
There seems one test case failure, however this is failing on 11.x head as well (on my local).
So not sure if this issue's change is the root cause of this one.
Other test case written for bug is passing on local.
Keeping this in needs work until we update the PR and pipeline is green.
Comment #13
mingsongThanks @Mohit for the fix.
The origin branch is based on the 10.2.x branch and there are some conflicts if targeting 11.x branch.
So I created a another branch based on the 11.x branch and a new MR targeting the 11.x branch.
https://git.drupalcode.org/project/drupal/-/merge_requests/7752
We need to fix this issue for all active branches(10.2.x, 10.3.x and 11.x)
Cheers,
Comment #14
mingsongComment #15
mingsongComment #16
kanchan bhogade commentedHi
I've tested MR !7752 on Drupal 10.2 and 11.x
MR is applied cleanly...
Test Result:
No error for the default image uploaded on the image field on the file usage page and the "File Uses Page" is displayed.
Adding Screenshots for references
RTBC+1
Keeping in "Needs review" for Code verification
Comment #18
smustgrave commentedShows test coverage.
Left a comment on the MR though.
Comment #19
mingsongComment #20
smustgrave commentedMuch better to me, thanks for taking care of that.
Comment #21
larowlanNice one folks, couple of comments on the MR
Comment #23
pradhumanjain2311 commented@larowlan i didn't understand how to remove getValue call but i tried to reduce a loop please review.
Comment #24
larowlanLeft a comment clarifying my point @pradhumanjain2311 - thanks