Would it not be a good idea to make it possible to use the core autocomplete widget? It could be great for the cases where people can choose several/unlimited languages.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

matsbla created an issue. See original summary.

matsbla’s picture

I see there is the autocomplete, but seems like not working to me (just searching searching without finding something).

Also; It gives you option to add several items under each other with each own autocomplete widget..

Maybe it is possible to just use the same autocomplete widget as core uses for tag fields? Check attached image.

dakala’s picture

Assigned: Unassigned » dakala
dakala’s picture

@matsbla: Suggestion sounds good to me. Attached patch has implementation of a new autocomplete tags style widget.

  • johnv committed 83b729e on 8.x-1.x authored by dakala
    Issue #2707625 by dakala, matsbla: Add autocomplete widget
    
johnv’s picture

Version: 8.x-1.x-dev » 8.x-1.0
Status: Active » Fixed

Thanks, committed, including some reshuffling, added by my development environment.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

@baux’s picture

I'm working on a site with the addressfield 1.1 release, but I still have problems with both "Language autocomplete" and "Language autocomplete (Tags style)".

In the first case the values are not loaded and the wheel doesn't appear to search for the values, but no error is shown in the "Recent log messages".

In the second case (Tags style), the system shows a blank page in the content page creation and the following error is shown in the recent log messages:

Notice: Trying to get property of non-object in Drupal\languagefield\Plugin\Field\FieldWidget\LanguageAutocompleteWidget->formElement() (line 57 of <PATH>/public/modules/languagefield/src/Plugin/Field/FieldWidget/LanguageAutocompleteWidget.php).

As info, (if apply for the first error): I'm using D8 with Bootstrap theme v3.0 rc1

johnv’s picture

Status: Closed (fixed) » Active
matsbla’s picture

For me autocomplete widget is working, but if I set the form display to Autocomplete (Tags style) I also get the error:

Fatal error: Call to a member function getSettableOptions() on a non-object in /home/d1m2n/www/sites/default/modules/languagefield/src/Plugin/Field/FieldWidget/LanguageAutocompleteWidget.php on line 60

johnv’s picture

Errors #8 and #10 are happening if no default value is set in the field definition, and you are using the Tags widget. Below patch should fix that.

  • johnv committed 54d6389 on 8.x-1.x
    Issue #2707625 by dakala, matsbla: Add autocomplete widget
    
johnv’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.