Automatically closed - issue fixed for 2 weeks with no activity.
- ๐ต๐นPortugal jrochate
I also think the widget approach works better.
I would like to add a request:
- respect the default value defined on the field
I mean, when there is no default value and the field is not mandatory, the fact that we use the widget to get priority countries shouldn't make the selection list pre-select the first priority country.
This is happening now, and it looks like a bug.For me, the expected behaviour is only auto-fill the select box when the field has a pre-defined country selected, no mater has priority countries or not.
- ๐ณ๐ฑNetherlands arjenk
Works nice and I like the widget approach. Two suggestions:
1. The indentation between the priority countries and the regular countries list seems a bit off. The priority countries appear to have less indentation compared to the regular list.
2. Consider renaming the widget from "Select with priorities" to "Select list with priorities" to be more consistent with the naming convention of the original "Select list" widget.
- First commit to issue fork.
- ๐ณ๐ฑNetherlands batigolix Utrecht
I took a new approach and I created a dedicated field widget for the priority countries.
- ๐ต๐นPortugal jrochate
Sure, no prob. I think is make a lot of sense, because it's normal to have a "most used" countries, but you don't want to loose the opportunity to know the rest of them.
For example: select all european countries first, and then the rest of the world if your use case is primarily targeted to Europe.
Or your own country first, because it will be 90% of the income users.Thank you for your efforts on this.
- ๐ณ๐ฑNetherlands batigolix Utrecht
Thank you for reviewing this. I still have some doubts whether this new feature makes sense. Especially whether it should. be combined with the selected countries field.
I will leave this open for a little while to get more feedback.
- ๐ต๐นPortugal jrochate
Works as expected, but when is on first use, there are some warnings about undefined variables.
- Edit a country field just after installing the patch:
Warning: Undefined array key "priority_countries" in Drupal\country\Plugin\Field\FieldType\CountryItem->fieldSettingsForm() (line 142 of modules/contrib/country/src/Plugin/Field/FieldType/CountryItem.php) Warning: Undefined array key "show_priority_separator" in Drupal\country\Plugin\Field\FieldType\CountryItem->fieldSettingsForm() (line 152 of modules/contrib/country/src/Plugin/Field/FieldType/CountryItem.php) Warning: Undefined array key "priority_separator_text" in Drupal\country\Plugin\Field\FieldType\CountryItem->fieldSettingsForm() (line 159 of modules/contrib/country/src/Plugin/Field/FieldType/CountryItem.php) Warning: Undefined array key "priority_countries" in Drupal\country\Plugin\Field\FieldType\CountryItem->fieldSettingsForm() (line 142 of modules/contrib/country/src/Plugin/Field/FieldType/CountryItem.php) Warning: Undefined array key "show_priority_separator" in Drupal\country\Plugin\Field\FieldType\CountryItem->fieldSettingsForm() (line 152 of modules/contrib/country/src/Plugin/Field/FieldType/CountryItem.php) Warning: Undefined array key "priority_separator_text" in Drupal\country\Plugin\Field\FieldType\CountryItem->fieldSettingsForm() (line 159 of modules/contrib/country/src/Plugin/Field/FieldType/CountryItem.php)
- After saving that specific country field definitions, the variables are set, so no more warnings.