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.
Would be great to be able to restrict allowed values. Ability to select only certain states as options, the way that Views allows for exposed filters; or at least to set a default state (/province). So, something like hierarchical checkboxes (Country/State) on config page, to limit the address options for localized use.
I'd welcome even a patch for that.
Comments
Comment #1
greta_drupal CreditAttribution: greta_drupal commentedOr read-only & hidden values for country and state.
Comment #2
greta_drupal CreditAttribution: greta_drupal commentedOops. My bad. You actually can set default state. (Lost track of which content type I had modified.)
This module is a lifesaver! Wasted a lot of time on a different address / geocoding module.
Comment #3
nithinkolekar CreditAttribution: nithinkolekar commented@greta_drupal
are you sure it is possible to set default state/province?
I don't find it in field settings with latest dev version. could you please share info/screenshot?
Comment #4
bojanz CreditAttribution: bojanz commentedPlease open new issues instead of reopening old ones.
The ability to set the default state (or any other address component other than the country) was removed from Addressfield 1.0 because it was exposing an unfixable Drupal core issue around the default value handling. See #2392863: Remove the default values instance setting, introduce a default country instance setting.
You can implement hook_addressfield_default_values_alter() as documented in addressfield.api.php instead.