commit be42bf84f89637025af6f3f92ece4636c9fe6c80
Author: Damien Tournoud <damien@commerceguys.com>
Date:   Fri Oct 21 12:34:18 2011 +0200

    Issue #1316788 by Les Lim and myself: add the option to hide the country field if only one country is available.

diff --git a/plugins/format/address-hide-country.inc b/plugins/format/address-hide-country.inc
new file mode 100644
index 0000000..65c0660
--- /dev/null
+++ b/plugins/format/address-hide-country.inc
@@ -0,0 +1,22 @@
+<?php
+
+/**
+ * @file
+ * Hide then country when only one country is available.
+ */
+
+$plugin = array(
+  'title' => t('Hide the country when only one is available'),
+  'format callback' => 'addressfield_format_address_hide_country',
+  'type' => 'address',
+  'weight' => -80,
+);
+
+/**
+ * Format callback.
+ *
+ * @see CALLBACK_addressfield_format_callback()
+ */
+function addressfield_format_address_hide_country(&$format, $address, $context = array()) {
+  $format['country']['#access'] = (count($format['country']['#options']) > 1);
+}
