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.
Hi,
I use Address Field 7.x-1.2 on a Drupal 7.43 web site.
I need to print the address components (thoroughfare, postal code, city, country) with PHP in a Display Suite code field.
I can't manage to print to country full name. The following code prints the country code :
$adresse = $payeur->field_user_adresse2['und'][0]['thoroughfare']."
";
$adresse .= $payeur->field_user_adresse2['und'][0]['postal_code'] . " " . $payeur->field_user_adresse2['und'][0]['locality']."
";
$adresse .= $payeur->field_user_adresse2['und'][0]['country'];
Is there a way to achieve this ?
Thx in advance for your support.
Comments
Comment #2
ashish.verma85 CreditAttribution: ashish.verma85 commentedhi, you can do something like this:
$countries = _addressfield_country_options_list();
print $countries[$countrycode];
Please check and let me know.
Comment #3
bojanz CreditAttribution: bojanz at Centarro commentedComment #5
Richard15 CreditAttribution: Richard15 commented+1 for ashish.verma85!
Comment #6
steveoriol+1 for ashish.verma85 :-)