Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When using Bean with an autocomplete EntityReference field, the autocomplete text field uses the bean's optional title field to indicate the block rather than the label, thus making the editorial process more confusing than it should be.
Comment | File | Size | Author |
---|---|---|---|
#5 | bean-label-in-entity-reference-field-1911262-7945347.patch | 1.08 KB | SofiaSund |
Comments
Comment #1
DamienMcKennaApproaching this from both sides - a corresponding request for the EntityReference module: #1911266: autocomplete field should use field selected for sorting
Comment #2
indytechcook CreditAttribution: indytechcook commentedDuplicate of #1916938: Empty block name in entity reference field. I'm moving to that one since it has a better description.
Comment #3
stBorchertSorry to reopen but this isn't really a duplicate of #1916938: Empty block name in entity reference field.
Having an empty title for a Bean makes it unfindable via Entity reference. On the other hand if you have multiple Beans with identical titles (but different labels) it is not possible to find the correct bean to insert.
Adding this simple sub-class of EntityReference_SelectionHandler_Generic fixes this UX problem (at least it has been fixed for us ;) ):
Comment #4
indytechcook CreditAttribution: indytechcook commented@stBorchert can you please format this as a patch so I can see the full impact.
Comment #5
SofiaSund CreditAttribution: SofiaSund commentedI couldn't find this fixed anywhere in the 7.x-1.x-dev branch. Here is a patch with stBorchert's code from #3. It works well for me (previously beans with empty title fields where displayed as empty lines in entity reference fields, now the admin label is displayed instead of the title).
Comment #6
joel_osc CreditAttribution: joel_osc commentedI tried this patch and I am still unable to find via autocomplete untitled beans from my entityreference field. I ended up doing the following (hack) to make the autocomplete work, by adding this to the entityreference.handler.bean.inc file:
Comment #7
joelpittetThis is related #1995770: Issue with Automatic Entity Label and may be an easier fix.
Comment #8
joel_osc CreditAttribution: joel_osc commentedYup, that seems to do the trick. Thanks!
Comment #9
indytechcook CreditAttribution: indytechcook commentedComment #10
JeroenTPatch worked for me.
Comment #11
DamienMcKennaPlease test the latest dev release instead of this patch, now that #1995770: Issue with Automatic Entity Label has been committed.
Comment #12
skwashd CreditAttribution: skwashd at Dave Hall Consulting for Pfizer, Inc. commentedThis issue appears to have been fixed in Entity API (see #1995770). This patch is no longer required. Closing as outdated.