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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

xatoo’s picture

Here 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.

xatoo’s picture

Version: 7.x-1.1 » 7.x-1.x-dev
Status: Active » Needs review
steven.wichers’s picture

Status: Needs review » Needs work

This 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.

cameron prince’s picture

I 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.

cameron prince’s picture

Here'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.

cameron prince’s picture

The patch in #5 won't apply due to a header problem. Here's a replacement.

ShaneOnABike’s picture

Ok so for me it is outputting the proper numbers now which is cool but not the labels? Ideas...

kienan’s picture

For 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>

michielkenis’s picture

Actually, I made it work by simple modifying a single line :)

Neograph734’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
511 bytes

@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.

ordermind’s picture

I 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.

  • jcisio committed 9f755b2 on 7.x-1.x authored by ordermind
    Issue #2010452 by cameronbprince, xatoo, Neograph734, ordermind,...
jcisio’s picture

Title: Phone gets rendered between address field 1 and state country fields » Phone gets rendered between address field 1 and state country fields (CR: weight change)
Status: Reviewed & tested by the community » Fixed

Thanks. Committed and pushed. I've changed the title so that I will remember to add this weight change to the release note.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.