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'm migrating a client's website to Drupal 7 using Migrate. I'm trying to export address fields to .csv using views. In a user view, i see the following tokens but they just won't print.
Can someone help me figure what it is I'm missing?
[field_address_country] == Content: Mailing Address (field_address)
[field_address_aname] == Content: Mailing Address (field_address)
[field_address_is_primary] == Content: Mailing Address (field_address)
[field_address_phone] == Content: Mailing Address (field_address)
[field_address_city] == Content: Mailing Address (field_address)
[field_address_street] == Content: Mailing Address (field_address)
[field_address_additional] == Content: Mailing Address (field_address)
[field_address_province] == Content: Mailing Address (field_address)
[field_address_fax] == Content: Mailing Address (field_address)
[field_address_postal_code] == Content: Mailing Address (field_address)
Thanks!
Comments
Comment #1
bisonbleu CreditAttribution: bisonbleu commentedWell, I spent too many hours trying to display Addresses' sub-fields - and I just couldn't.
Then I came across this comment and was finally able to break the darn Addresses data into its sub-fields. Works great. Nice trick that might come in handy in other similar situations.
In short add the Mailing Address field and exclude it from the display. Then add a Customfield of type PHP code and set its value to something like this.
<?php echo $data->node_data_field_address_field_address_street; ?>
To figure out the exact naming scheme of the sub-field use the print_r function.
<pre><?php echo $data; ?></pre>
Ant this is what you'll get.
Hope this is helpful.