monymirza's blog

Convert ISO country code to country name

While using Drupal Address Field module, When it needs to customize field, its variable returns country as ISO code. Like, if "Pakistan" will return "PK".
This funtion will help to convert ISO country code to country name.
 
 
<?php
$country_iso = $node->field_address['und'][0]['country']; // Example, return "TR"
$country = _addressfield_country_options_list($country_iso);
Tags: 

Drupal 8 development explained for Drupal 7 developers

I've seen some Drupal module developers out there have a lot of trepidation about moving to Drupal 8, most often via hearsay from others or via occasionally dipping in to look around and being spooked by newfangeldy stuff like namespaces, object-oriented code, and weird directory structures.

Subscribe to RSS - monymirza's blog