Problem/Motivation
When a user has no access to the media library item, the media library is still validating the field. This leads to a message 'The image field is required', while the user sees no field to upload a widget.
Steps to reproduce
- Configure a content type with a required Media field and configure the form display to use the media library widget
- Enable content translation, and mark your media field as not translatable.
- Configure translation to hide fields that are not translatable.
- Create a new node with an image.
- Translate the node and click on save
Proposed resolution
Add a check to see if the field was visible for the user
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | 3267401-5.patch | 3.9 KB | acbramley |
| #5 | 3267401-5-test-only.patch | 3.04 KB | acbramley |
Issue fork drupal-3267401
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:
Comments
Comment #3
nils.destoop commentedInitial merge requests, but probably still needs some tests
Comment #5
acbramley commentedAdded tests, this should be red/green.
Comment #7
smustgrave commentedTried verifying this issue.
Enabled a 2nd language
Translate an Article content type but uncheck the image field
Create a node
Add a translation
I don't see the image field (that's good)
I click save (no error)
Is there a step I'm missing?
Comment #8
acbramley commented@smustgrave did you make the field required? And it needs to use the media library widget. Updated the IS
Comment #9
smustgrave commentedSo following those steps.
When I go to translate the page I'm seeing my media library field there even though it is unchecked in the content translation page.
Comment #10
smustgrave commentedDisregard my previous comment. I was able to generate the error.
I applied the patch but still am not able to get past it.
Comment #11
smustgrave commentedHaving a bad case of the Mondays early. I used the MR and that did not work. Using the patch I was able to save the form.
I see the patch has a red/green pattern so that's good.
Seems like a simple check so I'm comfortable to mark it.
Comment #14
luksakThe MR works great for me.
Comment #15
tjtj commentedI am still getting this in Drupal 9.5.3
Comment #16
acbramley commentedRan #5 against 10.1.x and got the expected red/green combo. The previous failure was a random one. Back to RTBC.
Comment #18
lauriiiLooks like a random fail
Comment #22
catchCommitted/pushed to 10.1.x, cherry-picked to 10.0.x and 9.5.x, thanks!