I'm using IEF Complex forms on several content types to select a referenced entity with Entity Browser. All worked fine until RC 19 when the "remove" button disappeared from the form when an entity is selected. I determined this is because I have not also enabled "allow users to add new..." on the widget; this is because I find the UI confusing for my users when that option is enabled and, further, for User entities this function doesn't work. While I do get the "edit" button for the selected entity, I need to be able to allow users to replace the selection.
Create a node with a reference field to another entity;
Set up a Complex IEF form that allows users to add existing entities but not create new entities;
Create a new node of this type and assign an entity to the reference field via IEF;
Note that you may only edit the entity, not remove it.
It appears that a check was added in 869ba998 to see if there are more than one referenceable entity before allowing the "remove" button to be enabled (see src/Plugin/Field/FieldWidget/inlineEntityFormComplex.php circa line 327). The problem is, Drupal\Core\Entity\EntityReferenceSelection\SelectionInterface::getReferenceableEntities returns an array keyed by the entity type, so the check in the form isn't checking how many referenceable entities there are, but effectively is checking if there is more than one referenceable entity type. We need to check the inner key's results, not the root results.
I''l work up a patch for this.
Active
3.0
Code