Problem/Motivation

When we use Entity browser with taxonomy we can add the same term in a multiple value field without any error.

Proposed resolution

Change the condition who check if the entity is already referenced by the field by using ids.

Remaining tasks

User interface changes

API changes

Data model changes

Comments

vqgr created an issue. See original summary.

vqgr’s picture

vqgr’s picture

Status: Active » Needs review
samuel.mortenson’s picture

Issue tags: +Nashville2018, +D8Media, +Novice
k_a_l’s picture

working on this issue at DrupalCon Nashville

yannick menard’s picture

I'll take a lool too to familiarise in Drupalcon Nashville

oknate’s picture

I checked the original function and it has this code now:

if ($value['entity'] && $value['entity']->id() == $entity->id()) {
  $form_state->setError($reference_form['entity_id'], t('The selected @label has already been added.', ['@label' => $labels['singular']]));
  break;
}

It was changed here:
#2675684: Existing reference can not be replaced with another

I have a fix in comment #12 on #3011469: Inline Entity Form won't submit after form error, that also has test coverage.

oknate’s picture

Version: 8.x-1.x-dev » 8.x-2.x-dev
oknate’s picture

Assigned: vqgr » Unassigned
Issue tags: -Nashville2018, -D8Media
StatusFileSize
new5.19 KB

Copying patch over from #3011469: Inline Entity Form won't submit after form error

Since it has test coverage, I think it's an improvement on #2.

It also has test only patch to demonstrate the bug.

oknate’s picture

Reroll, #9 wouldn't apply against current HEAD.

oknate’s picture

oknate’s picture

Rerolling

Oops, empty patch.

oknate’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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