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 was originally going to post this ticket to the addressfield issue queue, but having looked at some older posts it looks like there is no desire to allow phone number support in the module (see http://drupal.org/node/1317132) so I am posting here. If it's the wrong thing to do I will open the ticket for addressfield rather than addressfield_phone.
Basically, the addressfield_render_address #pre_render function has an if statement to check the field keys:
...
if (in_array($key, array('name_line', 'first_name', 'last_name', 'organisation_name', 'country', 'administrative_area', 'sub_administrative_area', 'locality', 'dependent_locality', 'postal_code', 'thoroughfare', 'premise', 'sub_premise'))) {
...
This is causing the phone fields to be ignored when rendering the address.
Sorry is this isn't the right place to post.
Comment | File | Size | Author |
---|---|---|---|
#14 | interdiff.txt | 4.01 KB | drclaw |
#14 | addressfield_phone-phone_fields_not_rendered-1883330-14.patch | 3.51 KB | drclaw |
#12 | addressfield_phone-phone_fields_not_rendered-1883330-12.patch | 2.13 KB | johannez |
#11 | conditional-phones.patch | 2.19 KB | omerida |
Comments
Comment #1
jcisio CreditAttribution: jcisio commentedI think the "right" place depends on how you fix that bug ;) (the bug in the other issue).
Comment #2
calefilm CreditAttribution: calefilm commentedI think I am having this problem. Maybe my issue is unrelated. I cannot display a user's phone number in views. In my view:
select,
formatter: default
format handlers: Phone number and extension
Nothing appears.
Comment #3
gloomcheng CreditAttribution: gloomcheng commentedsame situation, not only address field phone but also address field nothing appears when set the formatter to default.
Comment #4
gloomcheng CreditAttribution: gloomcheng commentedUpdated: There is one way could show address field if set the formatter to 'one line'.
I found some error code below if I set the formatter to 'default', anyone knows what problems?
Comment #5
sajosh CreditAttribution: sajosh commentedPhone number is not showing up with the rest of the Address Fields.
Any ideas on why it's not showing up?
I have a clean install of D7.21, AFP7.x-1.0, and AF7.x-1.0, among many other modules.
Comment #6
jcisio CreditAttribution: jcisio commentedHave you tried the latest dev?
Comment #7
sajosh CreditAttribution: sajosh commentedJust tried to install dev but couldn't. I disabled it, uninstalled it, but the 1.0 version still shows up on the List (disabled). I tried installing dev anyway but erred out stating module exists.
So something is wrong with it's uninstall.
Any suggestions?
Comment #8
jcisio CreditAttribution: jcisio commentedIt would be your problem. When you delete the 1.0, replace with 1.x-dev, Drupal won't and can't show up the 1.0 version.
Moreover, I think it is a duplicate of #1883286: #pre_render callback requires a return statement.
Comment #9
Stephen Winters CreditAttribution: Stephen Winters commented@ sajosh
I had the same situation, uninstalled Address Field Phone version 7.1.0, but it still showed in the list of modules. I think what happens when you uninstall a module is that the module is uninstalled from the database, but is still present in the Drupal files. I went into CPanel and deleted it from sites/all/modules and then was able to install the 7.x-1.x-dev version of this module.
Stephen
Comment #10
mazdakaps CreditAttribution: mazdakaps commentedhello using the patch i found from the link above ifixed the phone rendering for the views but the result shows all the results in one line without the title. I did some changes and it shows the titles as it should . I put the code below
Comment #11
omerida CreditAttribution: omerida commentedAttached patch will only display a phone field if it has a non-empty value.
Comment #12
johannez CreditAttribution: johannez commentedHi guys,
I combined #10 and #11, put the proper names and added a weight, so that the phone numbers appear after the country (it's strange that the country block has a weight of 100).
This should work for most people.
Comment #13
masher CreditAttribution: masher commentedPatch #12 worked great. Thanks
Only I had to set
'#weight' => 150,
to get the phone info below the countyComment #14
drclaw CreditAttribution: drclaw commentedPatch in #12 works well. Seemed a bit weird to run it through a form element theme wrapper though. I added a new theme wrapper for addressfield_phone that outputs the #title in a span next to the phone number.
Comment #15
RKopacz CreditAttribution: RKopacz commentedjust FYI, I was trying to get the phone numbers to display when added as a field to a profile2 profile, using page manager and panels to display the user profile. the patch in #14 did the trick. Thanks to @johannez and @drclaw for pulling that patch together!
Just in case anyone else has a similar problem when using profile2 and page manager / panels.
Comment #16
pcambraPatch works fine, thanks!
Comment #18
jcisio CreditAttribution: jcisio commentedI don't like to add a theme, but as that's the way it works, so committed and pushed.
Comment #20
hitesh.koliI used #10 and put proper weight so that it displays below the address.