selecting views entityreference for entityref lookup is not being applied.

test

create an entityreference view of (e.g.) articles.
add an entityreference field for articles to an entity
check display formatter is set to rendered entity
override default entityref selector with views
check form formatter is set to autocomplete.
check node edit form.
autocomplete not displaying view content only default.
change form formatter to select list.
refresh node edit form.
select list is displayed not views override.
change form formatter to radio buttons.
refresh node edit form.
select list is displayed not views override.

i am using a clean installation of drupal 8.6.4 interested to hear about reproduceability.

thanks

CommentFileSizeAuthor
#2 views entityreference.png153.45 KBSyntapse
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

laurencefass created an issue. See original summary.

Syntapse’s picture

FileSize
153.45 KB
specky_rum’s picture

Same here. I'm using a taxonomy reference field but otherwise my steps are identical. I've got two field showing in the view but my select list for the field only displays the titles as if the view hadn't been configured at all. This on D8.6.4

specky_rum’s picture

Version: 8.5.x-dev » 8.6.4
rowrowrowrow’s picture

Also running into this issue. Looking at it now.

tetranz’s picture

I took a look at this and I'm not sure if it's a bug.

For me, the view is working. I can edit the view to change the selection criteria and what field is searched etc.

However, it only ever shows the label of the referenced entity. e.g., the title of a node. That is working as designed in

Drupal\views\Plugin\EntityReferenceSelection\ViewsSelection::getReferenceableEntities()

As far as I know, there is no code in core intended to shows the fields of the view.

I think this contrib module https://www.drupal.org/project/entity_reference_views_select does what you want, at least for select and radio buttons.

Syntapse’s picture

thanks i have reached the same understanding.

i think its a flaw in the design if not in the code.

the label is not very useful on its own.

tetranz’s picture

Status: Active » Closed (works as designed)
joel_osc’s picture

Version: 8.6.4 » 8.7.2
Status: Closed (works as designed) » Active

I think this needs to be re-assessed... working 'improperly' as designed is still a bug. In D7 an entity reference view showed the results of the view and not the entity title as it is doing in d8. This should be fixed as it is both incorrect and not very useful as it has been designed.

joel_osc’s picture

Status: Active » Closed (duplicate)
Related issues: +#2174633: View output is not used for entityreference options

This issue is active here #2174633: View output is not used for entityreference options closing as duplicate.