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 needed this for a project, so I thought I'd go ahead and create it and provide the patch. It's analogous to the existing "Country to ISO Code" plugin, but for U.S. States. For example, if your Feed has a "state" field that includes data like, "Connecticut", and "New Mexico", this plugin will convert them to "CT" and "NM" - suitable for mapping to fields provided by the Addressfield module.
Patch will be attached in first comment below.
Thanks,
-mike
Comment | File | Size | Author |
---|---|---|---|
#5 | feeds_tamper-states-1963384-5.patch | 2.92 KB | ultimike |
#2 | feeds_tamper-states-1963384-2.patch | 3.03 KB | ultimike |
#1 | state_to_abbrev-1963384-1.patch | 0 bytes | ultimike |
Comments
Comment #1
ultimike...and here's the patch.
Thanks,
-mike
Comment #2
ultimike...and how about a patch that actually works (oops)...
-mike
Comment #3
twistor CreditAttribution: twistor commentedCan you clean up the commented out function?
Also, are you sure about the t() wrapping the state name?
Comment #4
twistor CreditAttribution: twistor commentedComment #5
ultimikeChris,
Whoops - sorry about the commented out function. It's now removed in the attached patch.
As for the t(), I was unsure about it as well, but I modeled my patch after the country_to_code.inc plugin that already exists - that plugin uses the same pattern, including the t().
-mike
Comment #6
twistor CreditAttribution: twistor commentedAlrighty, committed to 7.x
http://drupalcode.org/project/feeds_tamper.git/commit/23f9a3c
Comment #7
twistor CreditAttribution: twistor commentedI should note that I've removed the t(). I need to check on the country to code plugin, but it doesn't really make sense, afaict.
Comment #8
twistor CreditAttribution: twistor commentedI'm not backporting plugins anymore at this point.