Not sure if it's a bug or a feature request. Great module, BTW.

Steps to reproduce:
1.Create Entity Reference View which is filtered to contain only nodes of one content type (or any other filter, really).
2. Create Entity Reference Field to reference nodes.
3. Set Entity Reference Field to be filtered by Entity Reference View created in 1.
4. Under Form Display, set Inline Entity Form to permit referencing of existing nodes.
5. Now create or edit a node which contains the new Entity Reference Field:

Result: when populating the entity reference field, the autocomplete offers all nodes, and not just the nodes filtered by Entity Reference View.

The autocomplete for adding a new reference behaves correctly if in step 3 the 'default' method of selecting referenced nodes is chosen in field settings, instead of the entity reference view method.

The autocomplete as primary widget (instead of inline_entity_form with 'reference existing entity' enabled) does respect filtering by a an entity reference view, when that is set.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

John_B created an issue. See original summary.

bojanz’s picture

Category: Bug report » Feature request

This was never supported in 7.x-1.x either. There's a patch in the queue for that, but it hardcodes a bunch of entity types. We need to solve it generically.

tne_’s picture

The attached patch should allow a configured entity view reference to be used.

Status: Needs review » Needs work
tne_’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

  • bojanz committed 973a429 on 8.x-1.x authored by tne_
    Issue #2629836 by tne_: Views entity references not supported
    
bojanz’s picture

Title: Views entity references not supported » Respect the entity reference view in "Add existing"
Status: Needs work » Fixed

Thanks tne_, that did the trick.

We'll still want some kind that will restrict the bundles shown for "Add new" based on the view, but fixing "Add existing" is a good first step.

Status: Fixed » Closed (fixed)

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