Add token for "Street address lines 1/2/3 combined"

Created on 28 March 2023, over 1 year ago
Updated 16 January 2024, 10 months ago

Problem/Motivation

We'd like to be able to output both address lines in metatag `og:location`, schema.org Place, etc. without a trailing comma when address line2 isn't available.

Proposed resolution

Create a new token that optionally appends a comma and address line 2 only when address line 2 is available.

Remaining tasks

Add tests

User interface changes

None

API changes

None

Data model changes

None

✨ Feature request
Status

Needs review

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States hawkeye.twolf α™αŽ©α―αα— Unalatogiyasdi, Tsalaguwetiyi (Cherokee country)

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

Comments & Activities

  • Issue created by @hawkeye.twolf
  • @hawkeyetwolf opened merge request.
  • Status changed to Needs review over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States hawkeye.twolf α™αŽ©α―αα— Unalatogiyasdi, Tsalaguwetiyi (Cherokee country)
  • Assigned to sickness29
  • Status changed to Needs work about 1 year ago
  • Issue was unassigned.
  • Status changed to Needs review about 1 year ago
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 7.3 & MySQL 5.7
    last update about 1 year ago
    33 pass
  • πŸ‡ΊπŸ‡¦Ukraine sickness29

    Reworked to apply to latest 8.x-1.x, fixed few coding standard issues.
    Renamed CountryNameTokenTest to AddressTokenTest and extended it to contain test case for new token

  • πŸ‡·πŸ‡ΈSerbia bojanz

    Good idea!

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.1.4 + Environment: PHP 8.0 & MySQL 5.7
    last update 11 months ago
    Patch Failed to Apply
  • Status changed to Needs work 11 months ago
  • πŸ‡·πŸ‡ΈSerbia bojanz

    Needs a reroll for 2.0.x.

    We also need to add address_line3 the same way we added address_line2.

  • Status changed to Needs review 11 months ago
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update 11 months ago
    44 pass
  • πŸ‡¦πŸ‡·Argentina tguerineau

    I have created a patch for the 2.0.x.

    I have adapted this patch for the 2.0.x branch, which includes support for an additional third address line.

    Changes Made:
    1. Renamed the token from 'address_lines_both' to 'address_lines_combined' to better reflect its functionality, as it now combines up to three address lines.
    2. Updated the logic in address.tokens.inc to handle the third address line. The token now correctly concatenates the available address lines, separating them with commas as appropriate.
    3. Manually tested the new token with the Meta Tag module. I used the [node:field_address:address_lines_combined] token in the default meta description for content. The token correctly outputs:

    • Just the first line when only the first address line is present.
    • The first and second lines, separated by a comma, when both are present.
    • All three lines, each separated by a comma, when all are present.
    • No additional text in the meta description when the address field is empty.
  • πŸ‡·πŸ‡ΈSerbia bojanz

    Thanks!

    This is now 2.1.0 material, so bumping the version.

Production build 0.71.5 2024