# Patch fixes:
# - 'div' tag for country
# - remove 'administrative division' for GB
# - change field positions for GB
# - change labels for GB
--- plugins/format/address.inc
+++ plugins/format/address.inc
@@ -63,6 +63,7 @@
   );
   $format['country'] = array(
     '#title' => t('Country'),
+    '#tag' => 'div',
     '#options' => _addressfield_country_options_list(),
     '#required' => TRUE,
     '#attributes' => array('class' => array('country')),
@@ -80,7 +81,7 @@
   }
 
   // Those countries generally use their administrative division in postal addresses.
-  if (in_array($address['country'], array('AR', 'AU', 'BR', 'BS', 'BY', 'BZ', 'CA', 'CN', 'DO', 'EG', 'ES', 'FJ', 'FM', 'GB', 'HN', 'ID', 'IE', 'IN', 'IT', 'JO', 'JP', 'KI', 'KN', 'KR', 'KW', 'KY', 'KZ', 'MX', 'MY', 'MZ', 'NG', 'NI', 'NR', 'NZ', 'OM', 'PA', 'PF', 'PG', 'PH', 'PR', 'PW', 'RU', 'SM', 'SO', 'SR', 'SV', 'TH', 'TW', 'UA', 'US', 'UY', 'VE', 'VI', 'VN', 'YU', 'ZA'))) {
+  if (in_array($address['country'], array('AR', 'AU', 'BR', 'BS', 'BY', 'BZ', 'CA', 'CN', 'DO', 'EG', 'ES', 'FJ', 'FM', 'HN', 'ID', 'IE', 'IN', 'IT', 'JO', 'JP', 'KI', 'KN', 'KR', 'KW', 'KY', 'KZ', 'MX', 'MY', 'MZ', 'NG', 'NI', 'NR', 'NZ', 'OM', 'PA', 'PF', 'PG', 'PH', 'PR', 'PW', 'RU', 'SM', 'SO', 'SR', 'SV', 'TH', 'TW', 'UA', 'US', 'UY', 'VE', 'VI', 'VN', 'YU', 'ZA'))) {
     $format['locality_block']['administrative_area'] = array(
       '#title' => t('State'),
       '#size' => 10,
@@ -354,6 +355,21 @@
     unset($format['locality_block'][$first_child]['#prefix']);
   }
 
+  // Settings for the United Kingdom
+  if ($address['country'] == 'GB') {
+    // Customise labels
+    $format['street_block']['thoroughfare']['#title'] = t('Address line 1');
+    $format['street_block']['premise']['#title'] = t('Address line 2');
+    $format['locality_block']['locality']['#title'] = t('City/town');
+    $format['locality_block']['postal_code']['#title'] = t('Post code');
+    // Post code below city/town
+    $format['locality_block']['#attributes'] = array('class' => array('locality-block'));
+    $format['locality_block']['locality']['#tag'] = 'div';
+    $format['locality_block']['postal_code']['#tag'] = 'div';
+    unset($format['locality_block']['#attached']['css']);
+    unset($format['locality_block']['postal_code']['#prefix']);
+  }
+  
   if ($context['mode'] == 'form') {
     // Provide a wrapper ID for AJAX replacement based on country selection.
     if (!isset($format['#wrapper_id'])) {
