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.
I have a Canadian phone number field with the "Add the country code if not filled by the user" option selected. When a number without a country code is entered, the country code is prefixed to the field. But when a country code is provided, the country code is removed.
In format_ca_phone_number
, a valid entered country code is never added to $phonenumber
.
Comment | File | Size | Author |
---|---|---|---|
#3 | keep_provided_ca_country_code-1915188-3.patch | 939 bytes | pbuyle |
Comments
Comment #1
pbuyle CreditAttribution: pbuyle commentedThe attached patch preprend the country code extracted from the input. The country code is validated and will have to be 1 if provided. If the "_Add the country code if not filled by the user_", the country code is prepended only if not already provided.
Comment #2
pbuyle CreditAttribution: pbuyle commentedA space is needed after the country code.
Comment #3
pbuyle CreditAttribution: pbuyle commentedI should test my patch before hitting submit...
Comment #4
pbuyle CreditAttribution: pbuyle commentedComment #5
drclaw CreditAttribution: drclaw commentedI can confirm that the patch performs as advertised. Thanks! :)