Closed (fixed)
Project:
Real Name
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Reporter:
Created:
10 Aug 2012 at 10:17 UTC
Updated:
26 Mar 2014 at 06:55 UTC
Jump to comment: Most recent, Most recent file
This patch is a first rough version of autocomplete functionality with entityreference fields.
It discards settings that you can have on the entityreference field (Like whether to search on Start Only, of Contains) and just searches on Contains.
But its a start.
Comments
Comment #1
hass commentedComment #2
hass commentedI have added Contains and Starts with support and fixed all remaining tasks. This works great for me now.
Comment #4
hass commentedSuxxx Eclipse copy and paste bugs
Comment #5
hass commentedThere seems to be a validation issue in node forms. This fails and the form error is shown:
Comment #6
hass commentedThe autocomplete need to keep
$matches[$account->name]as is, except on entity references. Needs a major overhaul of this patch.Comment #7
hass commentedNew patch should fix all issues and is fairly smarter as it prepares the module for more modules with autocomplete user fields.
Comment #8
hass commentedNew patch
Comment #9
hass commentedHeck, bad patch.
Comment #10
hass commentedFinal.
Comment #11
dave reidentity reference should be using entity_label() for display, is it not? Or is this to enable searching/querying on the real name? Maybe we should provide a default Reference selection view instead as the proper solution?
Comment #12
hass commentedIt"s for searching the real name. It's extremly confusing that i need to enter the username and get the realname as result. Additional the usernames are often fantasy names. This patch search for both to get the best results we can provide.
Edit: i may confuse myself with #985944: Replace user autocomplete with realname autocomplete. This patch just make the entity references work like the user selection field. Additional it searches in both username and realname what looked extremly usable for me.
Comment #13
brightboldThanks! This did exactly what I was hoping - allowed people to search for the real name instead of the username, and then continue seeing the real name as the result.
Could you reroll the patch for the latest dev? It didn't apply cleanly because the realname_autocomplete function seems to have changed a lot. I made some uninformed choices about which lines to keep and which to overwrite, and it seems to work, but I don't really recommend that as a patching strategy.
Comment #14
hass commentedRe-roled patch attached.
Comment #15
hass commented@Dave: I'm not sure if I understand this. Can you explain this a bit more, please?
I thought entity_label() is only used on output in view mode, not in edit mode forms. I've written these autocomplete based on the
_entityreference_autocomplete_tags_validate()function that only looks for an integer in brackets.Comment #16
japerryWe've tested this in commons, and the patch in #14 works as described.
Comment #17
super_romeo commentedThanks for patch.
But there are some notices:
Notice: Undefined index: admin в функции realname_autocomplete() (строка 352 в файле /home/u6819/domains/cargo-system.ru/sites/all/modules/realname/realname.module).
Notice: Undefined index: admin в функции realname_autocomplete() (строка 352 в файле /home/u6819/domains/cargo-system.ru/sites/all/modules/realname/realname.module).
Notice: Undefined index: Attergyundege в функции realname_autocomplete() (строка 352 в файле /home/u6819/domains/cargo-system.ru/sites/all/modules/realname/realname.module).
Notice: Undefined index: Drupal в функции realname_autocomplete() (строка 352 в файле /home/u6819/domains/cargo-system.ru/sites/all/modules/realname/realname.module).
Notice: Undefined index: EmainaSuimi в функции realname_autocomplete() (строка 352 в файле /home/u6819/domains/cargo-system.ru/sites/all/modules/realname/realname.module).
Comment #18
hass commented@super_romeo: This looks independed from this patch. Please open a new case.
Comment #19
jessehsIt seems like if the autocomplete field is not an entityreference type then the fallback is to use "Begins with" core behavior. This makes UI hard for some things. Ex: at the Organic Groups `/group/node/[nid]/admin/people/add-user` path to add users to groups.
How about adding a `realname_autocomplete` variable setting at `/admin/config/people/realname` so a person could decide what to default to for all user autocomplete fields?
Comment #20
hass commentedFeel free to create a new feature request, but don't highjack this case please.
Comment #21
hass commentedMarked #1979380: "contains" instead of "starts with" on autocomplete as duplicate.
Comment #22
hass commentedMarked #1409314: User Search does not Search Real Names as duplicate.
Comment #23
hass commentedhttp://drupalcode.org/project/realname.git/commit/2ec306b
Comment #25
japerryThis fix is the cause of #2225889: Notice: Undefined offset: 5 in _og_field_widget_replace_autocomplete_path()
Marking needs work because it changes the output of the entityreference api as seen below:
Comment #26
hass commentedPlease open a new case and write a repro case. Your screenshot is not really helpful. Post your patch over there, too.
I do not understand what may be wrong here. Maybe og is the root cause.