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.
This phone block prints in the wrong part of the address block, mainly because the state and country fields have a high weight attached to it.
The weight of the phone block should really be set higher than both of those.
In _addressfield_phone_render_address the $format['phone_block'] just needs a weight higher than 100.
I'm happy to patch it up if you're happy with the suggestion.
Comments
Comment #1
xatoo CreditAttribution: xatoo commentedHere is a patch. I've added some minor other changes. A class that allows for theming the phone block and I've added different classes for phone and fax numbers.
Comment #2
xatoo CreditAttribution: xatoo commentedComment #3
steven.wichers CreditAttribution: steven.wichers commentedThis fixes the issue, but...
It modifies and adds classes to things. I agree that the classes need to be fixed, but that should be its own standalone ticket.
What about the fax number? Does it need a weight? I put in a fax number and extension and neither got rendered (another, unrelated issue?), so I can't say if they also need weights.
Comment #4
cameron prince CreditAttribution: cameron prince commentedI tested this patch in conjunction with the addressfield patch here: https://drupal.org/node/1225292#comment-7790173
This patch does move the phone number below the address, but I can also confirm that all the phone numbers aren't rendered (as steven.wichers mentioned above). In my case, I'm seeing Contact Phone, Phone Extension and Fax Number. The Mobile Number is missing and there is no spacing between the Contact Phone and Phone Extension.
Comment #5
cameron prince CreditAttribution: cameron prince commentedHere's an updated patch that fixes both the order and the missing mobile number. I also added a label for the extension with some spacing.
Comment #6
cameron prince CreditAttribution: cameron prince commentedThe patch in #5 won't apply due to a header problem. Here's a replacement.
Comment #7
ShaneOnABike CreditAttribution: ShaneOnABike commentedOk so for me it is outputting the proper numbers now which is cool but not the labels? Ideas...
Comment #8
kienan CreditAttribution: kienan commentedFor the phone extensions, when rendering in a view, the " Ext. " is doubled. In fact, anything I put, other than a blank space, in the '#prefix' of phone_number_extension, is output twice.
<div class="phone"><span class="phone-number">+1-999-999-9999</span> Ext. Ext. <span class="phone-extension">111</span></div>
Comment #9
michielkenis CreditAttribution: michielkenis as a volunteer commentedActually, I made it work by simple modifying a single line :)
Comment #10
Neograph734@michielkenis, your solution does not work as this affects the file in the addressfield module, this project has no access to those files.
The patch of #6 no longer seems to apply, so a new patch is attached.
Considering the fact that this issue is 3 years old and the patch is only one line, I went ahead an changed it to RTBC already.
Comment #11
ordermind CreditAttribution: ordermind commentedI agree that #11 is the obvious fix for this issue, but it's not written in the regular git format so here's an identical fix with a different format.
Comment #13
jcisio CreditAttribution: jcisio at Axess Open Web Services for ARTE G.E.I.E. commentedThanks. Committed and pushed. I've changed the title so that I will remember to add this weight change to the release note.