- Issue created by @Nikit
Currently, it searches through all entered data, which isn't ideal because I only want to show the user their own data. I created a patch that allows the use of Views for search. Now I can filter, sort, use dynamic arguments, and rewrite the output of fields as I want.
Sample of limiting entered values by current user for field A at Article content type:
Content type “Article” has text field “Field A”.
1. Show set to Fields.
2. Add “Field A”.
3. Add filter for “Field A”, set Operator to “Starts with”, “Contain” and so on.
4. You can sort by “Field A”
5. Add Global:Null — here current entity ID provided, but it's NOT used here.
6. Add “Content: Authored by” for filtering by current user.
7. You can enable aggregation to prevent duplication querying.
8. Enabling Distinct will not help as #7, since it's distinct also NID.
9. Pager will override from “field A” widget settings.
1. Set “In View”
2. Set “Selected View” above view.
3. This count used for View pager limit.
Enter some text, and you will see only own entered text suggestions.
1. The count
argument for the existing_values_autocomplete_widget.autocomplete
route was removed, and the bundle of the current editing entity was added.
2. Also, I didn't fix PHP CS errors, since it will be fixed on another issue. So it will raise new PHP CS errors — I will provide new patch after committing
this issue →
.
3. I also fix code with missed count and distinct in DB querying in AutocompleteController.php
, row #56-57.
1. Possibly, caching is required to prevent calculating $field_column and $field_widget each time.