Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The integration with the IEF is not well implemented i think, if we select items that already been selected, then you can't select other items anymore, your can reproduce this behavior this way:
- Select element that already has been selected in the IEF Your will have a validation error handled by the entity browser module (entity_browser_entity_form_reference_form_validate)
- Re-select a different entity that hasn't been selected in the IEF
- Validation error (element already exist) does not go away, when we should have element added to IEF
Thanks
Comments
Comment #2
BerdirPHP doesn't have operator overloading, so whatever the problem is exactly, it has nothing to do with that.
Comment #3
oknateWe need steps to reproduce. Closing until we get more information.
Comment #4
oknateReopening, I'll try to reproduce. I think by "exists" he means "selected"
Comment #5
oknateComment #6
oknateComment #7
oknateI was able to recreate the error, after making a change to the function entity_browser_entity_form_reference_form_validate
I think that's not working now. I created an issue for that:
#3044316: entity_browser_entity_form_reference_form_validate fails to validate
I have seen this error before, now that I think about it.
Comment #8
oknateComment #9
oknateComment #10
oknateHere's a video of the error. It seems no action can remove the form error once it's been set.
Comment #11
oknate$form_state->getValue(['field_test_content', 'form', 'entity_browser', 'entity_ids']) = 'node:5 node:5 node:5 node:4 node:4'
even though I only have one item previously selected, and I'm selecting one item.
Comment #12
oknateHere's a fix for this and #3044316: entity_browser_entity_form_reference_form_validate fails to validate
Comment #13
oknateComment #14
oknateTest only patch should fail.
Patch with test coverage should pass.
Comment #15
oknateAdding minor coding standard fix.
Comment #17
oknateHere's a different "test only" patch, as the first one is demonstrating #3044316: entity_browser_entity_form_reference_form_validate fails to validate, rather than this issue.
Comment #18
oknateSame as #15, just reposting after posting #17, so last post is good patch.
Comment #20
nassazHello @oknate thank you for all these details and patch, your video reflects my problem well at first, I'll check your patch in fresh install.
Comment #21
oknateComment #22
oknateComment #25
oknateWent ahead and committed. Berdir writes "had a quick look, seems fine, ajax id stuff is always tricky".
Comment #26
oknate