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.
Notice: Undefined index: field in realname_field_widget_form_alter() (line 448 of D:\Webserver\drupal\modules\realname\realname.module).
Comment | File | Size | Author |
---|---|---|---|
#28 | emptyrecords-before-after-autocomplete.png | 26.92 KB | ramreddy.kancherla |
#26 | empty-result.png | 17.13 KB | ramreddy.kancherla |
#25 | support_for_autocomplete--2705279-25.patch | 5 KB | Ronald van Belzen |
#18 | support_for_autocomplete--2705279-18.patch | 4.66 KB | Ronald van Belzen |
|
Comments
Comment #2
grahlThe attached patch is a band-aid to get rid of the error message. Entity reference has been moved into core and this hook needs to be rewritten to support the autocomplete handler correctly.
Comment #3
grahlAs far as I can tell, the code regarding the form widget was still as in D7 and attached is a port of it. Since I am not sure that it is even possible to robustly override hook_widget_form_alter() as happened in D7 I chose to write a separate widget. If someone wants to try to make that work that's fine by me but the attached solution works fine for me at least.
If the RealNameController will be committed to the project I'm willing to provide unit tests for it.
Comment #4
hass CreditAttribution: hass commentedGreat, but what about:
Autocomplete matching
Comment #5
hass CreditAttribution: hass commentedA configured match operator "Contains" is not working.
Comment #6
hass CreditAttribution: hass commentedThis patch confuses me a lot. EntityReferenceAutocompleteWidget.php is completly different and I guess this may not work properly in all cases.
you changed the type, maxlength and other stuff.
Comment #7
grahlHi
Due to another module I couldn't work on this anymore. The comment you are referring to is a left-over, entity_autocomplete isn't used in that variant, I just used it as a starting point.
That being said, there is a bug in the loader for it. You can find and save users but editing the page with that again will cause an error.
To solve this more generally I started extending entity_autocomplete again but haven't gotten very far. I've attached that work-in-progess but that isn't nearly done, I just won't have the time to work on this as much as I'd like this month.
Comment #8
gokulnk CreditAttribution: gokulnk at Azri Solutions commentedCombined both the patches and rerolled it as the patch was not applying to the latest head.
With this patch I am getting the following error.
Uncaught PHP Exception Symfony\\Component\\Routing\\Exception\\InvalidParameterException: "Parameter "bundle_type" for route "realname.real_name_controller_autocomplete" must match "[^/]++" ("" given) to generate a corresponding URL." at /core/lib/Drupal/Core/Routing/UrlGenerator.php line 199,
Comment #9
gokulnk CreditAttribution: gokulnk at Azri Solutions commentedAny update on this? Currently I think this is the major issue that is holding back the adoption of this module in Drupal8. If this is fixed the module should be good for an alpha release.
Comment #10
Christopher Riley CreditAttribution: Christopher Riley commentedPatch works great for me even patching via composer.
Comment #11
hass CreditAttribution: hass commented#4, 5, 6, 8 look not like a committable patch.
Comment #12
Christopher Riley CreditAttribution: Christopher Riley commentedPatch no longer applies to the latest version and error is back.
Comment #13
7thkey CreditAttribution: 7thkey as a volunteer commentedUpdated and cleaned #9 patch. No errors but still needs work.
When i start fillin into "Authored by" the full name the autocomplete does not work at all. The autocomplete list shows the Full Name but the search does not match by "Full Name".
Comment #14
hass CreditAttribution: hass commentedComment #18
Ronald van Belzen CreditAttribution: Ronald van Belzen as a volunteer commentedMaybe this approach is viable.
Comment #19
grahlNumber 18 works great for me, thanks!
Comment #20
hass CreditAttribution: hass commentedWhy is this not using EntityAutocompleteMatcher? The getMatches() shows how to implement the match param CONTAINS or start with.
This is a CONTAINS only. In D7 we also had "START WITH".
Comment #21
Ronald van Belzen CreditAttribution: Ronald van Belzen as a volunteer commentedThe data in the db table realname is not represented by a ContentEntity (yet). This prevents the use of the EntityAutocompleteMatcher to retrieve the data. Maybe creating a ContentEntity for Realname is a good idea?
In the patch 18 the query contains a unnecessary join for that solution, btw.
I will make a patch that makes the CONTAINS and START WITH distinction.
Comment #23
hass CreditAttribution: hass commented@Ronald: I worked on your patch and implemented the missing START WITH. As it works fine, I just committed it. If you know how to implement this ContentEntity I'm happy to see your patch to move this forward. Let's move this to a follow up case.
Comment #24
hass CreditAttribution: hass commentedThanks all for the hard work.
Comment #25
Ronald van Belzen CreditAttribution: Ronald van Belzen as a volunteer commentedJust for reference the improvement I talked about in #21.
Comment #26
ramreddy.kancherla CreditAttribution: ramreddy.kancherla at Azri Solutions commentedI tested both dev and beta1 modules, When user's realname token values are empty, getting empty result in autocomplete widget.
Comment #27
hass CreditAttribution: hass commentedNot sure how this is possible with #2874168: Empty realname bubble into site
Comment #28
ramreddy.kancherla CreditAttribution: ramreddy.kancherla at Azri Solutions commentedThank you for the quick response @hass.
Getting empty realname in autocomplete widget.
I followed these steps.
1) Installed latest dev module.
2) In realname configuration page, I changed token values. For this token some users have values and some users do not have any value.
3) In node add page, at Author Information section, I searched for the users using auto complete and getting empty result along with realname values.
Strange thing is before performing autocomplete in node add/edit page, realname table has values for users who have token value and after searching for users in autocomplete widget in the table there are empty records for users.
Comment #29
hass CreditAttribution: hass commentedPlease post your realname token string in code tags in the referenced case.
Comment #30
ramreddy.kancherla CreditAttribution: ramreddy.kancherla at Azri Solutions commentedHere is token
[user:field_first_name] [user:field_last_name]
.I created two text fields in the /admin/config/people/accounts/fields with "field_first_name", "field_last_name" machine names.
Comment #31
hass CreditAttribution: hass commentedCan you post this to #2874168: Empty realname bubble into site please!!! It has nothing to do with the issue here.