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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ntijani created an issue. See original summary.

Berdir’s picture

PHP doesn't have operator overloading, so whatever the problem is exactly, it has nothing to do with that.

oknate’s picture

Status: Active » Postponed (maintainer needs more info)

We need steps to reproduce. Closing until we get more information.

oknate’s picture

Status: Postponed (maintainer needs more info) » Needs work

Reopening, I'll try to reproduce. I think by "exists" he means "selected"

oknate’s picture

Title: Overloading of the "==" operator ? » Inline Entity Form unable to select after already exists error
Issue summary: View changes
oknate’s picture

Issue summary: View changes
oknate’s picture

I was able to recreate the error, after making a change to the function entity_browser_entity_form_reference_form_validate

-        if ($value['entity'] == $attach_entity) {
+        if ($value['entity']->getEntityTypeId() == $attach_entity->getEntityTypeId() && $value['entity']->id() == $attach_entity->id()) {

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.

oknate’s picture

Title: Inline Entity Form unable to select after already exists error » Inline Entity Form won't submit after form error
oknate’s picture

Issue summary: View changes
oknate’s picture

FileSize
5.02 MB

Here's a video of the error. It seems no action can remove the form error once it's been set.

oknate’s picture

$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.

oknate’s picture

oknate’s picture

Status: Needs work » Needs review
oknate’s picture

Test only patch should fail.
Patch with test coverage should pass.

oknate’s picture

Adding minor coding standard fix.

The last submitted patch, 14: 3011469-test-only.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

oknate’s picture

Here'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.

oknate’s picture

Same as #15, just reposting after posting #17, so last post is good patch.

nassaz’s picture

Hello @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.

oknate’s picture

oknate’s picture

  • oknate committed ba3e64c on 8.x-2.x
    Issue #3011469 by oknate: Inline Entity Form won't submit after form...

  • oknate committed 98ebc6e on 8.x-1.x
    Issue #3011469 by oknate: Inline Entity Form won't submit after form...
oknate’s picture

Went ahead and committed. Berdir writes "had a quick look, seems fine, ajax id stuff is always tricky".

oknate’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.