Consider adopting the core country.default schema

Created on 9 April 2024, 3 months ago
Updated 10 April 2024, 3 months ago

Problem/Motivation

Starting from 🌱 [META] Locale settings in Drupal make little (UX) sense Active
Drupal core has not used the core default country setting since #2276183: Date intl support is broken, remove it β†’
The option on the install form was recently removed πŸ“Œ Remove country setting from the installer Fixed
The vestigial read in dateFormatter was deprecated as well πŸ“Œ Remove country support from DateFormatter Active
and removed in 11.x πŸ“Œ Remove deprecated country call from 11.x Fixed

There is still an option to set it in RegionalForm and the schema itself. The only way to fully remove it would be to move the schema to contrib. Would the address module (as the largest module that actually uses it) be willing to adopt the setting?

I'll be compiling a list of modules that call the setting in: 🌱 [META] Locale settings in Drupal make little (UX) sense Active

Steps to reproduce

N/A

Proposed resolution

Create new default site country setting in address.

Remaining tasks

Determine if this is acceptable

User interface changes

New form field

API changes

N/A

Data model changes

Single call to \Drupal::config('system.date')->get('country.default'); would be updated to call internal settings.

🌱 Plan
Status

Closed: won't fix

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States nicxvan

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

Comments & Activities

  • Issue created by @nicxvan
  • πŸ‡ΊπŸ‡ΈUnited States nicxvan
  • πŸ‡ΊπŸ‡ΈUnited States nicxvan
  • Assigned to bojanz
  • πŸ‡ΊπŸ‡ΈUnited States dww

    Thanks for opening this issue. But hrm, reasons I don't love this proposal:

    1. This module has no global settings. It's "just" a set of render elements and field types. It seems like it'd be a little weird to add a whole configuration form for this one "global" setting.
    2. There's already been a lot of trouble and bugs around default countries. πŸ˜… But (I believe) it all works as expected now. If folks want a default country for a given address or country field, they can configure it at the field level.
    3. Seems a little wonky how ./src/Element/Country.php is using \Drupal::config('system.date')->get('country.default');. It seems to only happen for Address or ZoneTerritory elements that are required and have no default value. I don't completely follow the need for it at all.

    Personally, I'd rather just remove the references to it if core wants to remove this setting entirely, and not try to provide it ourselves. But I'll hand this over to @bojanz for input, since he understands these details better than I do...

  • πŸ‡·πŸ‡ΈSerbia bojanz

    +1 to what dww said.

    I am fine with not having or using this setting at all. We only introduced it in the 2.0 release ~4 months ago, to have a fallback when the field has no default value configured, and it was community requested.

  • Issue was unassigned.
  • πŸ‡ΊπŸ‡ΈUnited States dww

    @bojanz: Thanks for the input! I didn't notice that it was added so recently. I'd be fine with reverting that commit. Then we're no longer referencing this setting at all, and core could go forth and remove it...

    @nicxvan / @andypost: Looks like this is "won't fix", at least from our perspective here in address.module land. Do you want to just close this and open other issue(s) in other possible candidate projects? That seems cleaner than moving this one around.

  • πŸ‡ΊπŸ‡ΈUnited States nicxvan

    Yeah, as I was thinking about this more, address is a pretty hefty dependency for other modules just to have a default, and most modules use it the way you do, just to set a default on a form the user may override anyway.

  • Status changed to Closed: won't fix 3 months ago
  • πŸ‡ΊπŸ‡ΈUnited States dww

    Agreed, thanks.

Production build 0.69.0 2024