Problem/Motivation

Follow-up for #2174633: View output is not used for entityreference options: This covers the display of items previously selected in an autocomplete text field.

When the options for selection in an entity auto-complete relation text field are controlled via a view, the view fields are not used to display the selected entity on subsequent edits of the same entity; instead, the entity label is shown. This is a regression from Drupal 7.x.

Expected Results

In step 6, the text in the field should match what was configured in the view, the same way as it appeared when the selection was made in step 4.

Actual Results

In step 6, the text in the field is equal to the entity label, even though that's not the value that was in the field when the selection was made in step 4.

Steps to reproduce

  1. Create a view with an entity reference display and set it up to display more than one field as an inline field.
  2. Add an entity reference field using the auto-complete text field, using the entity reference view display, to a content type.
  3. Visit the node add form.
  4. Fill out the field that was added in step 2; this will show the selected entity as configured in the View (using the selected inline fields).
  5. Save the node
  6. Open the edit back up for editing.
  7. Look at the value that appears in entity reference field that was populated in step 4.

Proposed resolution

TBD

Remaining tasks

Update summary
Clean up MRs

User interface changes

NA

API changes

TBD

Data model changes

TBD

Release notes snippet

NA

CommentFileSizeAuthor
#60 2796341-60.patch10.96 KBandypost
#60 interdiff.txt3.16 KBandypost
#59 interdiff.txt2.74 KBandypost
#58 2796341-58.patch10.93 KBandypost
#53 interdiff_52-53.txt4.74 KBranjith_kumar_k_u
#53 2796341-53.patch10.93 KBranjith_kumar_k_u
#52 2796341-52.patch10.96 KBYury N
#48 interdiff_47_48.txt984 bytesanmolgoyal74
#48 2796341-48.patch3.19 KBanmolgoyal74
#47 interdiff_2796341_28-47.txt2.37 KBKurtTrowbridge
#47 2796341-47.patch3.19 KBKurtTrowbridge
#41 2796341-41.patch10.95 KBLendude
#41 interdiff-2796341-38-41.txt12.05 KBLendude
#38 2796341-38.patch5.6 KBLendude
#38 2796341-38-TEST_ONLY.patch2.17 KBLendude
#37 2796341-37.patch5.59 KBLendude
#37 2796341-37-TEST_ONLY.patch2.16 KBLendude
#33 2796341-33.patch3.42 KBsnehalgaikwad
#28 2796341-28.patch3.2 KBNeslee Canil Pinto
#18 entityreference_autocomplete_views_edit-2796341-18.patch3.2 KBphilipsoares
#4 entityreference_autocomplete_views_edit-2796341-4.patch3.04 KBimclean

Issue fork drupal-2796341

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Lendude created an issue. See original summary.

jonathanshaw’s picture

I'm might be up for making a start with this, but I need some guidance.

You say this is a regression from D7, could you point to the code in D7 that enables this? I scratched around in the entity_reference module and saw nothing obvious, but my understanding of D7 is very thin.

For D8, my first guess would be to modify the entity reference widget. Basically modify the formElement method so that each time it is called it checks the delta to see if it's the last (i.e. new value field item). If it is the last, then the code should work as it currently does. If it is not the last (i.e. an existing value) then it should check to see if we're using the views handler, and if we are then instead of the current code to build a form element, it should render a single row view instead. I'm very vague around what this last point means and how to do it.

However, that seems very invasive to the entity reference widget, which rather defeats the point of having selection handlers as plugins. Maybe it would be better to add an additional "renderableSelectionHandlerInterface" to the selection handlers. The widget would then see if the handler pluginimplemented that interface, and if it did call a "buildItem" method on it the handler plugin; if it did not (or if that returned null) it would fall back to building its current form element.

imclean’s picture

core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php looks like a good start. valueCallback() calls getEntityLabels(), when it could check for views under "#selection_settings" and process that accordingly.

For some example views code, see the interdiff in post 70.

imclean’s picture

Here's a start. It takes into account multiple results for a single field separated by commas.

I'm not sure if this is the right approach so there aren't any tests.

imclean’s picture

Status: Active » Needs review
imclean’s picture

A selection handler would be more flexible.

amateescu’s picture

A selection handler would be more flexible.

+++ b/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php
@@ -68,9 +69,14 @@ public static function valueCallback(&$element, $input, FormStateInterface $form
-        // Extract the labels from the passed-in entity objects, taking access
-        // checks into account.
-        return static::getEntityLabels($element['#default_value']);
+        if ($element['#selection_handler'] == 'views') {
+          return static::getEntityViewsResults($element);
+        }
+        else {
+          // Extract the labels from the passed-in entity objects, taking access
+          // checks into account.
+          return static::getEntityLabels($element['#default_value']);
+        }

Yes, ideally EntityAutocomplete::getEntityLabels() would invoke a method on the selection handler, because only it knows how to properly format its output.

jonathanshaw’s picture

Yes, ideally getEntityLabels() would invoke a selection handler because only it knows how to properly format its output.

In which case should we create a method with a more generic name like getEntityDisplay, and deprecate getEntityLabels?

On a separate subject, perhaps code here should build on the reorganisation in #2787873: Add a base class for entity reference selection handlers and fix the structure of their configuration which is quite well advanced.

amateescu’s picture

I wouldn't deprecate getEntityLabels() but add an additional optional argument to it, for example SelectionInterface $selection_handler = NULL, which, if given, will get the output from the passed-in selection through a getAutocompleteText() method.. or something like that.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

imclean’s picture

We're still using the patch in #4 with Drupal 8.2.x which is working well. When #2787873: Add a base class for entity reference selection handlers and fix the structure of their configuration is in we may revisit this if we're planning to update the relevant site to 8.4.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

C.E.A’s picture

I am encountering two issues about using entity reference view display in Drupal 8.6.1:

1) At the /node/[nid]/edit page, the select list widget for entity reference view display is showing only the username of the current logged in user for all the available options... and this is almost fixed with this patch (https://www.drupal.org/project/drupal/issues/2174633) and it is working for me !!

2) At the /node/[nid] page, the output of the select list entity reference view is broken and displaying only the username of the logged in user and referencing the user page as well !
I have been redirected to this issue as it will sove my problem, but after i applied the patch #4, the problem still exist and nothing has really changed !

And also I see that the last update on this issue was 2 years ago so am i on the right track or I am missing something here !?

jonathanshaw’s picture

At the /node/[nid] page, the output of the select list entity reference view is broken and displaying only the username of the logged in user and referencing the user page as well !

I don't think this issue will solve your problem. I think this issue is about what is shown in a widget or other form element e.g. at node /[nid]/edit for already selected items.

#2174633: View output is not used for entityreference options covers what is show in the selector when selecting new items, this covers the display ON THE FORM of already selected items.

In general to control what appears at node/[nid] you want to use the 'Manage display' not the 'Manage form display UI', and in particular you would normally use a 'Rendered entity' formatter not the 'Label' formatter.

However, if it's node author you want to mess with you're out of luck, because that's got weird legacy issues. You may well find it easiest just to hack what you want into your node theme template, it all depends on your exact use case and I suggest you try Drupal Answers if you want help with it.

C.E.A’s picture

In general to control what appears at node/[nid] you want to use the 'Manage display' not the 'Manage form display UI', and in particular you would normally use a 'Rendered entity' formatter not the 'Label' formatter.

I am aware already about the use of the "manage display" and not the "form display" but your mentioning about the "render entity" formatter put me again on the right track and now all is working as expected !

Or at least until this issue will be officially fixed !

Thank you once again, god bless,

philipsoares’s picture

I added new treatments.

When the autocomplete field is not a style tag, you do not need to enclose the value with double quotation marks.

When we have characters like & in the title, it is transformed into & amp;
To solve I added the html_entity_decode function before the strip_tags

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

kenton.r’s picture

I use the 2796341-18.patch and it works for me. It would be good to get this committed.

colan’s picture

mitchellshelton’s picture

I applied this patch and it is working as expected.

Just out of curiosity, is there a reason why the Entity ID is appended to the value?

For example, we have this currently:

$label = html_entity_decode(strip_tags(\Drupal::service('renderer')->renderPlain($result)))  . ' (' . $entity_id . ')';

Why not this instead:

$label = html_entity_decode(strip_tags(\Drupal::service('renderer')->renderPlain($result)));

I don't see a way to override this from within views. Perhaps I'm missing something, or just don't understand the history here.

Anyway, thanks for the excellent patch, huge help for me.

jonathanshaw’s picture

#22 the appended id is to disambiguate entities with identical labels

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Dries Arnolds’s picture

Maybe we can get this moving now that it's related issue is fixed?

amateescu’s picture

Status: Needs review » Needs work

Yup, it would be good to make some progress here :) See #7 for my thoughts on what the patch should do.

asak’s picture

Patch in comment 18 applies smoothly to 8.8.5 and resolves the issue correctly - this is RTBC.
May I suggest any additional changes go into new issues?

Now that #2174633 is committed this will be a nice issue to resolve as well.

Neslee Canil Pinto’s picture

Status: Needs work » Needs review
FileSize
3.2 KB

Path for 8.9.x

anruether’s picture

Issue summary: View changes

Clarified what this issue is about in the summary according to #16

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

danharper’s picture

Status: Needs review » Reviewed & tested by the community

I have tested this with 8.9.x and it seems to work.

larowlan’s picture

Component: entity_reference.module » views.module
Status: Reviewed & tested by the community » Needs work
Issue tags: +Bug Smash Initiative, +Needs tests, +Needs issue summary update

Thanks, this looks like the patch is long out of date, e.g. functions like drupal_set_message are gone in 9.x, and old array syntax is something we don't use anymore.

In addition we need some test coverage here.

We could also use an issue summary update to use the template, including steps to reproduce etc.

Also, there is no entity reference module anymore, so changing the component

  1. +++ b/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php
    @@ -341,6 +347,56 @@ public static function getEntityLabels(array $entities) {
    +  public static function getEntityViewsResults($element) {
    

    this needs a docblock

  2. +++ b/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php
    @@ -341,6 +347,56 @@ public static function getEntityLabels(array $entities) {
    +    $entity_ids = array();
    ...
    +    $results = array();
    ...
    +    $labels = array();
    

    this is using old array syntax

  3. +++ b/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php
    @@ -341,6 +347,56 @@ public static function getEntityLabels(array $entities) {
    +      drupal_set_message(t('The reference view %view_name cannot be found.', array('%view_name' => $view_name)), 'warning');
    ...
    +      drupal_set_message(t('You do no have access to the reference view %view_name.', array('%view_name' => $view_name)), 'warning');
    

    drupal_set_message has been removed, this needs to use the messenger service

  4. +++ b/core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php
    @@ -341,6 +347,56 @@ public static function getEntityLabels(array $entities) {
    +        'limit' => 0,
    +        'ids' => $entity_ids
    +      ]);
    

    the indenting is wrong here

snehalgaikwad’s picture

Status: Needs work » Needs review
FileSize
3.42 KB

Created patch for 9.1.x. Covered fixes addressed in #32.

jonathanshaw’s picture

Status: Needs review » Needs work

Thanks @snehalgaikwad! Please post an interdiff where possible when working on a patch.

NW for IS update and tests.

snehalgaikwad’s picture

Yes @jonathanshaw. I created patch for 9.1.x version(prev patch was for 8.9.x) with fixes mentioned so didn't add interdiff.

Lendude’s picture

Issue summary: View changes

IS update

Lendude’s picture

Here is a test for this. Test only patch is the interdiff (ok, one minor change to not get a php notice)

However....see #7/#8/#9 for the right path to fixing this. The current fix puts Views specific code inside the generic EntityAutocomplete handler, this is not what we want.

So this might come back green, but it still needs work.

Lendude’s picture

Lets try that again with patches rolled against 9.1.....

The last submitted patch, 38: 2796341-38-TEST_ONLY.patch, failed testing. View results

jonathanshaw’s picture

Status: Needs review » Needs work

NW per #37 as the fix needs to be fundamentally different

Lendude’s picture

Status: Needs work » Needs review
FileSize
12.05 KB
10.95 KB

Here we go with a rewrite. Probably needs a clean-up but lets see what the bots says this breaks.

Lendude’s picture

Status: Needs review » Needs work

Well, that broke less then I expected....

+++ b/core/modules/views/src/Plugin/EntityReferenceSelection/ViewsSelection.php
@@ -345,4 +348,53 @@ public static function settingsFormValidate($element, FormStateInterface $form_s
+      $label = html_entity_decode(strip_tags($this->renderer->renderPlain($result)))  . ' (' . $entity_id . ')';
...
+      if ($widget_has_tags) {
+        // Labels containing commas or quotes must be wrapped in quotes.
+        $label = Tags::encode($label);
+      }

I don't like that the Views code needs to do this. This needs to be done for all labels so we shouldn't have to repeat that logic.
Just not sure to to best refactor for that right now

kyberman’s picture

Thank you! I can confirm patch #28 works fine with 8.9.6.

chr.fritsch’s picture

Do we need the "($entity_id)" in the output of a ViewsSelection?

I think thats only releated to the EntityAutocomplete element. When you are using another element, for example select2, you don't need and want the braces with the entity_id in your results.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

westsonoma’s picture

Thank you! 2796341-41.patch installs and works without issue on Drupal core 9.0.7, and is exactly what I was looking for.

KurtTrowbridge’s picture

Thanks for this! I'm on 8.9.11 and #28 applied cleanly. I realized after the fact that none of this appears to be relevant to the 9.x patch, but for anyone using 8.9.x, I cleaned up the code standards issues mentioned in #32, fixed a typo, and added the ENT_QUOTES argument to html_entity_decode() to prevent entities with straight apostrophes (') from being escaped when printed.

anmolgoyal74’s picture

Status: Needs work » Needs review
FileSize
3.19 KB
984 bytes

Fixed minor CS issues in #47.

andypost’s picture

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

gbotis’s picture

Thanks! Just tested with Drupal 9.2 and works perfectly.

Yury N’s picture

Re-rolled patch #41 against 9.2.x

ranjith_kumar_k_u’s picture

SerShevchyk made their first commit to this issue’s fork.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Nathaniel’s picture

@ #52/#53 looks like a typo "entites" should be "entities".

#48 is working on 9.2. #52/#53 look like a different approach.

andypost’s picture

Not clear why interface renamed in latest patches, I see no reason for it

It needs proper re-roll and address #42

+++ /dev/null
@@ -1,29 +0,0 @@
-interface SelectionWithAutocompleteLabels {

+++ b/core/lib/Drupal/Core/Entity/EntityReferenceSelection/SelectionWithAutocompleteLabelsInterface.php
@@ -0,0 +1,27 @@
+interface SelectionWithAutocompleteLabelsInterface {

needs CR

andypost’s picture

Here's re-roll and small fixes (including CS)

@chr.fritsch re #44 - yes, entity IDs are needed (frontend could hide'em) otherwise there's no way to differentiate same-labeled entities, there's #2881892: UX: Hide entity ID in autocomplete widget

andypost’s picture

FileSize
2.74 KB

interdiff is 41 vs 58

andypost’s picture

Fix CS from #53

FILE: ...ity/EntityReferenceSelection/SelectionWithAutocompleteLabels.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
----------------------------------------------------------------------
  5 | WARNING | [x] Unused use statement
 14 | WARNING | [ ] Interface names should always have the suffix
    |         |     "Interface"
jonathanshaw’s picture

Status: Needs review » Needs work

Please everyone do not post patches that are not descended from #42 #58 / #60 as this is the only approach that has any chance of being committed, and it gets confusing when two different approaches are being worked on in the same issue.

As far as I can see #42 can be addressed fairly easily in EntityAutocomplete::getEntityLabels().

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

vasike’s picture

GuyPaddock’s picture

Two bugs that need to be addressed:

  • With both #48 and #60 -- titles that contain commas are not getting enclosed in quotes on load. I've confirmed that without any patch from this issue, core does this automatically when using a views filter, so it's a regression introduced by the patch.
  • With #60, apostrophes in titles are getting over-escaped. So, for example, a title like "0001-8675302 - I'm in your demo, making you smile (21)" loads as "0001-8675302 - I'm in your demo, making you smile (21)" with #60 applied but not with #48 applied.
GuyPaddock’s picture

Assigned: Unassigned » GuyPaddock

I'm going to take a stab at moving #60 over to an issue fork to address this feedback and the feedback from #42.

GuyPaddock’s picture

Also: see #2951134: Single-value autocomplete widgets don't warn about field cardinality, lose data silently if you want non-tag entity reference fields to validate the cardinality of each delta properly. I will not be adding the fix for that here, but it is a complementary fix.

GuyPaddock’s picture

Assigned: GuyPaddock » Unassigned
Status: Needs work » Needs review

Ok, I believe I've addressed all the feedback and the two bugs I found. Everything should be in MR 2761. Here is the inter-diff from 60:
https://git.drupalcode.org/project/drupal/-/compare/d4407da8d03dc727d7a5...

Each commit contains a detailed description of the changes I made.

GuyPaddock’s picture

Assigned: Unassigned » GuyPaddock
Status: Needs review » Needs work

Setting back to me to address test failures.

GuyPaddock’s picture

Assigned: GuyPaddock » Unassigned
Status: Needs work » Needs review

Hiding older patches.

GuyPaddock’s picture

ameymudras’s picture

Status: Needs review » Needs work

I have posted a few suggestions in the MR, please consider if they are relevant

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

liquidcms’s picture

Just to bring this up again as it has been asked a few times in this thread: "why is the (id) appended to the field result value?"

the only reply i see here is in #23: "the appended id is to disambiguate entities with identical labels" - but that's not a good answer. That's a Drupalism and is only a site specific requirement. We have entityref fields accessible to client's. They have no idea what that number means and in many cases, such as for user reference fields, this could even be considered a security issue.

These db id values should not be shown here.

NOTE: i am talking about the result which ends up in the field (not what is shown as options in the autocomplete)

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

dqd’s picture

I see all the points and worries but to get forward with this issue and its main focus and primary scope we should prevent to disperse discussion about corners of likes and dislikes in the solution and should minimize the scope as much as possible.

This issue isn't merely important for custom entities and projects like ECK and paragraphs but also for any entity types, which do not have mandatory title (label) field. Also in core, since there are discussions about to change the mandatory title field for nodes too.

EDIT (after further testing): To clarify (also for me) this issues scope here seem to be merely for the use of autocomplete and inline edit reference field formatter and similar form field formatters where you are able to CREATE NEW referenced items. I tested custom entities with select lists and alternative form field widgets like chosen with existing custom entities, and I used Views reference views to build custom Views reference select lists to choose from and the form field preview reflects the selected list item as is. So I assume this should be clarified in the issue summary?

Can somebody who is more into this issue, update the summary and can make some notes about what to do next to get forward so that others can chime in to help? Since this issue is a little bit dated it surely needs updates on the to-do list.

dqd’s picture

More investigating and maybe "good to know" information: For those who use inline_entity_form for creating new entities in the progress of adding them as references can use ief_table_view_mode to get a custom preview of the reference in the edit form display. This solves the problem of entities which have no "label" (title) field looking like empty entries in the preview. Thanks to @mnico for this contribution and important extension for the IEF workflow.

GuyPaddock’s picture

Assigned: Unassigned » GuyPaddock

Taking on additional rework.

GuyPaddock’s picture

Issue summary: View changes

I reviewed the MR feedback (thank you, @ameymudras). I've ticketed #3423053: Replace \Drupal calls with proper IoC in form elements under the #2729597: [meta] Replace \Drupal with injected services where appropriate in core meta issue. That issue should be appropriately scoped to rework form elements like the Entity Auto-complete text field to use DI. I am moving both \Drupal::service('plugin.manager.entity_reference_selection') calls in the class into a utility method and adding a todo that references #3423053. I believe that to be the most prudent way to avoid bloating the scope of this issue.

Regarding your feedback, @liquidcms, I agree with what I believe @dqd is saying -- the scope of this issue is to fix what value appears in the autocomplete field when a view is being used to drive selections. The question of whether an ID should be suffixed or not is outside the scope of this issue. The issue you are looking for is #2881892: UX: Hide entity ID in autocomplete widget and until that issue lands, the implementation in this ticket is consistent with both the way that the ID appears during initial selection with a view as well as autocomplete fields that are not driven by a view.

As for your other question, @dqd, it seems like you found a solution to your problem with IEF. Regardless, I have cleaned up the issue description to clarify that this issue is specific to autocomplete text fields. Please let me know if that addresses your issue, since IEF is completely separate.

GuyPaddock’s picture

GuyPaddock’s picture

GuyPaddock’s picture

Version: 11.x-dev » 9.5.x-dev
Component: views.module » entity_reference.module
Status: Needs work » Needs review

Just updated the branch for 9.5. My next update will update this for 10.1.x.

GuyPaddock’s picture

Version: 9.5.x-dev » 10.1.x-dev

Updated for 10.1.x.

GuyPaddock’s picture

Version: 10.1.x-dev » 11.x-dev
Assigned: GuyPaddock » Unassigned

Updated for 11.x. Ready for re-review.

smustgrave’s picture

Issue summary: View changes
Status: Needs review » Needs work
Issue tags: +Needs issue summary update, +Needs Review Queue Initiative

Issue summary appears to be missing a few sections

Added the missing sections but left TBD on sections for someone more familiar with the issue to speak on.

Also can we hide some of the MRs to just have the intended for 11.x branch. Can be backported later depending when this lands.