Add a honorific property to the field

Created on 16 March 2017, over 7 years ago
Updated 21 July 2023, over 1 year ago

Is it possible to add the new property to address field type?

Can salutation property be added to the address format? In my case we need Mr or Mrs (Frau or Herr in German) to be the part of the address format.

For now, I can't see any other opportunity than extending the AddressItem class with FieldType definition and create my own field type with this salution (like here https://www.lullabot.com/articles/extending-a-field-type-in-drupal-8 for example). This is not very practical, because I need then to double widgets and formatters and all other functionality that Address field already has.

Is there an easy way to alter the address format to accept a new field?

Thanks in advance.

💬 Support request
Status

Fixed

Version

2.0

Component

Code

Created by

🇩🇪Germany a.dmitriiev

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇩🇪Germany Anybody Porta Westfalica

    Same issue here, 6 years later. This is a real problem for Address field. For Drupal 7 there was at least a contrib module solving this: https://www.drupal.org/project/addressfield_title

    It had already been requested for Drupal 7 here in the early days: 💬 Salutation missing?! Fixed

    It's desperately needed, not only Germany I guess. Also for things like newsletters you'd often wish to know which salutation to use. I'm setting the priority to major to put some focus on this, hope that's okay.

    Re #14 we don't only need "Mr." and Mrs." but also the option to select nothing or "Divers". That part should be configurable of course. But as long as we say "Dear sir" / "Dear madam", there's a need for a salutation to be selected.

  • 🇷🇸Serbia bojanz

    I think it's obvious at this point that this won't be solved in Address itself.

    I suggest writing a contrib module that repurposes the additional_name column (moves it before the given_name, gives it the Honorific title, provides a dropdown with predefined options, provides a settings page for the list of options). The additional_name column is perfect for this since it's not shown by default anyway. And I see that a.dmitriiev has arrived at the same conclusion (#16).

  • Status changed to Fixed over 1 year ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024