Errors when using Autocomplete widget and Language groups

Created on 10 September 2024, 3 months ago
Updated 11 September 2024, 3 months ago

Problem/Motivation

The following errors occur when:
- Language groups are defined in the field settings
- Autocomplete of 'Autocomplete (tag style) widget is selected
- you try the enter a language in the field widget.

TypeError: mb_strtolower(): Argument #1 ($string) must be of type string, array given

The error is in LanguageAutocompleteController::autocomplete(), because the code assumes that the supplied list only contains languages, not groups.

An unexpected language is entered.

This happens when a language is selected that is not in the allowed list of values. The problem is that the autocomplete function does not parse the list correctly when language groups are enabled in the field settings.

Steps to reproduce

- Maintain one or more language groups
- Set the widget type to Autocomplete or AutocompletTagsStyle
- Edit a node with LanguageField and enter a language (either correct or incorrect).

Proposed resolution

- Check if the provide list entry is a string or an array.
- Flatten the list of valid options.

🐛 Bug report
Status

Fixed

Version

1.9

Component

Code

Created by

🇳🇱Netherlands johnv

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024