Show a label for the address_line2 field

Created on 28 April 2017, almost 8 years ago
Updated 8 March 2024, about 1 year ago

At least in our project, the client wants to have that visible, otherwise it is pretty unclear what the second text field there is for and it looks a bit broken.

Feature request
Status

Active

Version

1.0

Component

Code

Created by

🇨🇭Switzerland berdir Switzerland

Live updates comments and jobs are added and updated live.
  • Usability

    Makes Drupal easier to use. Preferred over UX, D7UX, etc.

  • Accessibility

    It affects the ability of people with disabilities or special needs (such as blindness or color-blindness) to use Drupal.

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.

  • 🇫🇷France sébastien-fr Nantes - France

    I agree that address field 2 is not configurable in the UI if it is rarely used but the solution is not so easy to find when you do not know the address module. Thank you @ Berdir for providing us with this example.

    I don't have any statics but the address_line2 field seems to me to be very widely used in France. It is used to indicate an additional address such as “building, floor, apartment”.

    /**
     * Process callback for address element.
     */
    function _custom_module_add_adress_label(array &$element, FormStateInterface $form_state, array &$complete_form) {
      $element['address_line2']['#title_display'] = 'before';
      $element['address_line2']['#title'] = t('Building / Floor / Apt');
      return $element;
    }
Production build 0.71.5 2024