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.
Synopsis
Inspired by Chosen Ajax which uses the Chosen jQuery plugin and a modified version of Ajax Chosen to make your autocomplete fields more user-friendly.
It supports auto-create option. It works with Entity reference field type only. All you need to do is set a Chosen Autocomplete option on Manage Form Display page.
Requirements
Chosen Library should be installed with Chosen module
Dependencies
Chosen Module
Known problems
Currently Chosen Module works with 1.6.1. library version.
How to use in Field UI
- Create (or edit an existing field) which has Entity Reference type
- Go to Manage Form Display page and select Chosen Autocomplete widget for this field.
Setting up this repository locally for the first time
git clone --branch 8.x-1.x https://git.drupal.org/sandbox/Gene/2831141.git chosen_autocomplete
cd chosen_autocomplete
Link to sandbox project https://www.drupal.org/sandbox/gene/2831141
Comments
Comment #2
EugeneChechel CreditAttribution: EugeneChechel commentedComment #3
PA robot CreditAttribution: PA robot commentedWe are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)
Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #4
aloknarwaria CreditAttribution: aloknarwaria at TO THE NEW commentedModule done there job but there is some UI issue whene I selected few elements.
Comment #5
EugeneChechel CreditAttribution: EugeneChechel commentedHi @aloknarwaria
Could you please be more exact? what UI issues you mentioned?
Comment #6
tvalimaa CreditAttribution: tvalimaa commentedI got Notice: Undefined index: #autocreate in Drupal\Core\Entity\Element\EntityAutocomplete::processEntityAutocomplete() if field setting "Create referenced entities if they don't already exist is off" is not turned on.
Comment #7
harsh.behl CreditAttribution: harsh.behl at TO THE NEW commentedHI I got similar notice: messageNotice: Undefined index: #autocreate in Drupal\Core\Entity\Element\EntityAutocomplete::processEntityAutocomplete() (line 119 of core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php).
when Create referenced entities if they don't already exist is checked off.
Also it is very slow to auto suggest options for ex: If I type test it takes 5-10 seconds to load.
Comment #8
itamair CreditAttribution: itamair as a volunteer commentedI just made the https://pareview.sh run on your project sandbox, and found this
FILE: /root/repos/pareviewsh/pareview_temp/README.txt
----------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
----------------------------------------------------------------------
3 | WARNING | Line exceeds 80 characters; contains 103 characters
8 | WARNING | Line exceeds 80 characters; contains 174 characters
10 | WARNING | Line exceeds 80 characters; contains 122 characters
----------------------------------------------------------------------
FILE: /root/repos/pareviewsh/pareview_temp/chosen_autocomplete.info.yml
--------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 1 LINE
--------------------------------------------------------------------------
1 | WARNING | Remove "project" from the info file, it will be added by
| | drupal.org packaging automatically
1 | WARNING | Remove "version" from the info file, it will be added by
| | drupal.org packaging automatically
--------------------------------------------------------------------------
Comment #9
EugeneChechel CreditAttribution: EugeneChechel commentedFixed Undefined index: #autocreate issue. Code sniffer issues with info.yml and README file have been fixed.
Comment #10
EugeneChechel CreditAttribution: EugeneChechel commentedComment #11
cchanana CreditAttribution: cchanana commentedHi EugeneChechel,
I just made the https://pareview.sh run on your project, and found this
FILE: /src/Plugin/Field/FieldWidget/ChosenAutocomplete.php
--------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
--------------------------------------------------------------------------
41 | WARNING | t() calls should be avoided in classes, use dependency
| | injection and $this->t() instead
53 | WARNING | t() calls should be avoided in classes, use dependency
| | injection and $this->t() instead
153 | WARNING | \Drupal calls should be avoided in classes, use
| | dependency injection instead
Comment #12
cchanana CreditAttribution: cchanana commentedComment #13
PA robot CreditAttribution: PA robot commentedClosing due to lack of activity. If you are still working on this application, you should fix all known problems and then set the status to "Needs review". (See also the project application workflow).
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #14
EugeneChechel CreditAttribution: EugeneChechel commentedComment #15
PA robot CreditAttribution: PA robot commentedClosing due to lack of activity. If you are still working on this application, you should fix all known problems and then set the status to "Needs review". (See also the project application workflow).
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #16
Ravi Cmsminds CreditAttribution: Ravi Cmsminds commentedHi,
I checked your module and found some issues and recommendations that you may be interested in :
FILE: ...sh/pareview_temp/src/Plugin/Field/FieldWidget/ChosenAutocomplete.php
--------------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
--------------------------------------------------------------------------
41 | WARNING | t() calls should be avoided in classes, use dependency
| | injection and $this->t() instead
53 | WARNING | t() calls should be avoided in classes, use dependency
| | injection and $this->t() instead
153 | WARNING | \Drupal calls should be avoided in classes, use
| | dependency injection instead
--------------------------------------------------------------------------
FILE: /root/repos/pareviewsh/pareview_temp/chosen_autocomplete.info.yml
--------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------
6 | WARNING | All dependencies must be prefixed with the project name,
| | for example "drupal:"
9 | WARNING | All dependencies must be prefixed with the project name,
| | for example "drupal:"
--------------------------------------------------------------------------
Comment #17
EugeneChechel CreditAttribution: EugeneChechel commentedFixed #11
Comment #18
sleitner CreditAttribution: sleitner commentedAutomated Review
Pareview details: https://pareview.sh/pareview/https-git.drupal.org-sandbox-gene-2831141.g...
Git errors:
Review of the 8.x-1.x branch (commit c6ffaf5):
hook_help()
. See https://www.drupal.org/docs/develop/documenting-your-project/module-docu... .This automated report was generated with PAReview.sh, your friendly project application review script.
Manual Review
The starred items (*) are fairly big issues and warrant going back to Needs Work. Items marked with a plus sign (+) are important and should be addressed before a stable project release. The rest of the comments in the code walkthrough are recommendations.
If added, please don't remove the security tag, we keep that for statistics and to show examples of security problems.
This review uses the Project Application Review Template.
Comment #19
apadernoIf you are still working on this application, you should fix all known problems and set the status to Needs review. (See also the project application workflow.)
Please don't change status of this application if you aren't sure you have time to dedicate to this application, or it will be closed again as won't fix.
I am closing this application due to lack of activity.