Closed (duplicate)
Project:
Address Field
Version:
7.x-1.0-beta2
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
23 Jan 2012 at 09:05 UTC
Updated:
25 Feb 2015 at 13:37 UTC
Jump to comment: Most recent
Comments
Comment #1
tvilms commentedHere's your question with some responses on StackExchange. It's a little more to go on:
http://drupal.stackexchange.com/questions/16232/how-to-hide-country-in-a...
Comment #2
userofdrupal commentedI found this api document page.
http://api.drupalhelp.net/api/addressfield/addressfield.module/group/add...
I think I might need to write a CTools plugin.
Comment #3
userofdrupal commentedanyone?
Comment #4
tvilms commentedHi there. Wanted to close the loop on this. @overflowing, maybe you could still use some info. If not, I'll leave this here for posterity.
Here's what I did to control the display formatting. I made a new plugin, modeled off the existing "address.inc" file in the addressfield/plugins/format directory and saved the new plugin in the same directory. I reviewed the existing file and changed and/or commented out aspects of the display format that I didn't like. As a result, I was able to end up with a format that only shows city and state, with no street address or zip code fields. I named my plugin "citystate.inc" and modified the function calls accordingly.
You'll need to experiment a bit with the existing functions & logic, but no doubt you'll be able to get something working.
Comment #5
les limI just submitted a patch that could help make this easier:
#1541384: Provide regular theme function for displaying an address as an alternative to formatter plugins
Please chime in over there and see if we can get something like this in.
Comment #6
userofdrupal commented@tvilms and @Les Lim I appreciate the followup will check these different methods out
Comment #7
funkeyrandy commentedhow did you get commas to display?
Comment #8
okeedoak commentedInstall Addressfield Tokens, then implement theme_addressfield_formatter__components($vars) in your template.php file. The last part of the function name "__components" corresponds to the "Address Components" format in Manage Display. In other words, each format has it's own function.
Comment #9
jhodgdonSee also #1649372: Update the format for U.S. addresses
Comment #10
bugster commentedfor the comma to display you could edit address.inc
find the US section and add
$format['locality_block']['locality']['#suffix'] = ',';for the abbreviation to show: edit address.inc, find the US section and add
$format['locality_block']['administrative_area']['#abbr'] = TRUE;and also edit the addressfield.module
find the function _addressfield_render_address(&$format, $address)
and replace the if-else statement
if (isset($child['#options']))withComment #11
mgiffordUnder "Manage display" it looks like we should be able to find some "widget configuration" to use. However I don't see where this might be.
I have the option of enabling/disabling the default setting but I should be able to configure or view the widget configs if I am to know what "Use the same configuration as the widget" actually means.
Oh ya, and "Use the same configuration as the widget" is missing a '.'
Comment #12
rszrama commentedAddress rendering itself is not configurable via the UI at the moment. It depends on properties of a renderable array generated by the various address field plugins that you toggle on in the checkboxes list when creating the address field. However, my commit / notes in #1427682-5: [API change] Make expanding an administrative area code to its full options list value optional directly address the original post but adding options / city comma suffix to fix U.S. addresses. The country is still there, but that's another animal... you might follow #1316788: Do not display country in address block if only one country option is available, and I'll address how to disable it from rendering when I add the developer documentation noted in #1267292: Document the user interface, API, and working with the form element. Because of those two issues, I'm going to close this one out as a duplicate.
Comment #13
colanFor what it's worth, there shouldn't be a comma after the city. See #2107705: Support different output formats, e.g. printed machine-readable vs. screen human-readable for details.
Comment #14
rudiedirkx commented