Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Would love to be able to have field info auto generated for theming purposes. Adding a patch which supplies rudimentary US-based address support for devel generate. Would be willing to make it more universal (or more correct, if I'm not doing it right). Feedback welcome.
Comment | File | Size | Author |
---|---|---|---|
#3 | addressfield.devel_generate.patch | 1.95 KB | Garrett Albright |
#2 | addressfield_devel_generate-1156776-2.patch | 19.59 KB | Sheldon Rampton |
addressfield_devel_generate.patch | 3.62 KB | wesnick |
Comments
Comment #1
wesnick CreditAttribution: wesnick commentedI should have set this to "needs work" to indicate that this is an incomplete patch
Comment #2
Sheldon Rampton CreditAttribution: Sheldon Rampton commentedHere's an updated patch with some differences. Instead of generating addresses at random, it loads a table of about 300 real addresses in multiple countries and then randomly selects one each time it needs to fill an addressfield. This is more useful for testing purposes, because they are real addresses so it is possible to see how they do with geocoding, mapping, etc. The 300 addresses include full street addresses as well as others that are incomple and consist only of city and country so it gives an approximation of the kinds of responses you might get if users were filling in the addresses.
The patch worked as expected when I tested it.
Comment #3
Garrett Albright CreditAttribution: Garrett Albright commentedHere's my approach (which I coded up before I found this issue…derp). On the site I'm building, addresses are limited to a single country, so I had my generation approach take that into account. It won't generate real geocodable/mappable addresses like Sheldon Rampton's above, but it's working for our needs.
Comment #4
rszrama CreditAttribution: rszrama commentedWow, #2 is quite robust. I'm happy to commit that as is, but can you tell me where you got these addresses from? I'd hate to include someone's real address on the off chance someone testing their fulfillment system accidentally ships something out. ; )
Comment #5
Sheldon Rampton CreditAttribution: Sheldon Rampton commentedHi, Ryan. The addresses come from this website that I built recently for a multinational hackathon project:
http://www.sanitationhackathon.org/
The addresses are hackathon event locations that were actually entered by event organizers. They are therefore real addresses, but they are not the addresses of individual people. They include conference centers, businesses, addresses of NGOs and government agencies. I chose this list because:
Comment #6
rszrama CreditAttribution: rszrama commentedThanks for the quick reply! Works for me. Let's put it in, and we can always remove items if someone decides it's an issue to be included. : P