Hi,

I have struggled some hours to track this down. The problem is that id_field_alias (in entityreference/views/entityreference_plugin_display.inc) is incorrectly set when relationships are linked (back to the same base table). Example:

AUTHOR (UID) => AUTHORED NODE => LINKED USERS (UID)

where the author UID is a contextual filter (the ID of the currently logged in user). Entity reference module uses "users_uid" instead "users_field_data_somefield_uid".

I have attached a very hackish patch and my exported view.

To reproduce it:

  1. Create a content type Family that has one multi-valued field that links to users (which are family members/children).
  2. Then create one Family node and link it to two users (which are your children).
  3. Create a content type Test that has one field that links to users (your children) and use a view to select the entities in the entity reference list. The view is like the example above.

Result: The select list only shows one user no matter how many children you have, and when you save you have actually added your self.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hansfn’s picture

Status: Needs review » Needs work

The last submitted patch, 1: entityreference-2321715-1.patch, failed testing.

hansfn’s picture

Fixing the paths in the patch and removing two blanks at the end of two comments.