Index: phone.module
===================================================================
--- phone.module	(revision 30984)
+++ phone.module	(working copy)
@@ -10,6 +10,36 @@
  */
 
 /**
+ * Implementation of hook_menu.
+ */
+function phone_menu() {
+  $items = array(
+    'admin/settings/phone' => array(
+      'title'             => 'Phone Field Settings',
+      'description'       => 'Configure options for the phone CCK field.',
+      'page callback'     => 'drupal_get_form',
+      'page arguments'    => array('phone_settings'),
+      'access callback'   => 'user_access',
+      'access arguments'  => array('administer content types'),
+      'type'              => MENU_NORMAL_ITEM,
+    ),
+  );
+  
+  return $items;
+}
+
+function phone_settings () {
+  $form['phone_formats'] = array(
+    '#type'           => 'checkboxes',
+    '#title'          => 'Available formats',
+    '#options'        => _phone_formats(),
+    '#description'    => t('Select all the phone number formats that should be available on this site.'),
+    '#default_value'  => variable_get('phone_formats', _phone_formats()),
+  );
+  return system_settings_form($form);
+}
+
+/**
  * Implementation of hook_field_info().
  *
  * Here we indicate that the content module will use its default
@@ -27,40 +57,17 @@
  * the database and in internal arrays, like content_fields().
  */
 function phone_field_info() {
-  return array(
-    'fr_phone' => array('label' => t('Phone Numbers - France')),
-    'be_phone' => array('label' => t('Phone Numbers - Belgium')),
-    'it_phone' => array('label' => t('Phone Numbers - Italy')),
-    'el_phone' => array('label' => t('Phone Numbers - Greek')),    
-    'ch_phone' => array('label' => t('Phone Numbers - Switzerland')),
-    'ca_phone' => array('label' => t('Phone Numbers - US & Canada')),
-    'cr_phone' => array('label' => t('Phone Numbers - Costa Rica')),
-    'pa_phone' => array('label' => t('Phone Numbers - Panamana')),
-    'uk_phone' => array('label' => t('Phone Numbers - United Kingdom')),
-    'ru_phone' => array('label' => t('Phone Numbers - Russia')),
-    'ua_phone' => array('label' => t('Phone Numbers - Ukraine - in Kiev')),    
-    'es_phone' => array('label' => t('Phone Numbers - Spain')),
-    'au_phone' => array('label' => t('Phone Numbers - Australia')),
-    'cs_phone' => array('label' => t('Phone Numbers - Czech Republic')),
-    'hu_phone' => array('label' => t('Phone Numbers - Hungari')),
-    'pl_phone' => array('label' => t('Phone Numbers - Poland - mobiles only')),    
-    'nl_phone' => array('label' => t('Phone Numbers - Netherland')),
-    'se_phone' => array('label' => t('Phone Numbers - Sweden')),
-    'za_phone' => array('label' => t('Phone Numbers - South Africa')),    
-    'il_phone' => array('label' => t('Phone Numbers - Israel')),
-    'nz_phone' => array('label' => t('Phone Numbers - New Zealand')),
-    'br_phone' => array('label' => t('Phone Numbers - Brazil')),
-    'cl_phone' => array('label' => t('Phone Numbers - Chili')),    
-    'cn_phone' => array('label' => t('Phone Numbers - China')),    
-    'hk_phone' => array('label' => t('Phone Numbers - Hong-Kong')),
-    'mo_phone' => array('label' => t('Phone Numbers - Macao')),
-    'ph_phone' => array('label' => t('Phone Numbers - Philippine')),
-    'sg_phone' => array('label' => t('Phone Numbers - Singapore')),    
-    'jo_phone' => array('label' => t('Phone Numbers - Jordan')),
-    'eg_phone' => array('label' => t('Phone Numbers - Egypt')),
-    'pk_phone' => array('label' => t('Phone Numbers - Pakistan')),    
-    'int_phone'=> array('label' => t('Phone Numbers - International Phone Numbers per E.123'))
-   );
+  $available_formats = variable_get('phone_formats', _phone_formats());
+  $global_formats = _phone_formats();
+  $formats = array();
+
+  foreach ($available_formats as $format) {
+    if ($format) {
+      $formats[$format] = array('label' => $global_formats[$format]);
+    }
+  }
+
+  return $formats;
 }
 
 /**
@@ -1013,3 +1020,49 @@
   $tests = file_scan_directory($dir, '\.test$');
   return array_keys($tests);
 }
+
+/**
+ * Helper function that retuns an array of all avaliable phone number formats.
+ */
+function _phone_formats() {
+  static $formats = array();
+
+  if (empty($formats)) {
+    $formats = array(
+      'fr_phone' => t('Phone Numbers - France'),
+      'be_phone' => t('Phone Numbers - Belgium'),
+      'it_phone' => t('Phone Numbers - Italy'),
+      'el_phone' => t('Phone Numbers - Greek'),
+      'ch_phone' => t('Phone Numbers - Switzerland'),
+      'ca_phone' => t('Phone Numbers - US & Canada'),
+      'cr_phone' => t('Phone Numbers - Costa Rica'),
+      'pa_phone' => t('Phone Numbers - Panamana'),
+      'uk_phone' => t('Phone Numbers - United Kingdom'),
+      'ru_phone' => t('Phone Numbers - Russia'),
+      'ua_phone' => t('Phone Numbers - Ukraine - in Kiev'),
+      'es_phone' => t('Phone Numbers - Spain'),
+      'au_phone' => t('Phone Numbers - Australia'),
+      'cs_phone' => t('Phone Numbers - Czech Republic'),
+      'hu_phone' => t('Phone Numbers - Hungari'),
+      'pl_phone' => t('Phone Numbers - Poland - mobiles only'),
+      'nl_phone' => t('Phone Numbers - Netherland'),
+      'se_phone' => t('Phone Numbers - Sweden'),
+      'za_phone' => t('Phone Numbers - South Africa'),
+      'il_phone' => t('Phone Numbers - Israel'),
+      'nz_phone' => t('Phone Numbers - New Zealand'),
+      'br_phone' => t('Phone Numbers - Brazil'),
+      'cl_phone' => t('Phone Numbers - Chili'),
+      'cn_phone' => t('Phone Numbers - China'),
+      'hk_phone' => t('Phone Numbers - Hong-Kong'),
+      'mo_phone' => t('Phone Numbers - Macao'),
+      'ph_phone' => t('Phone Numbers - Philippine'),
+      'sg_phone' => t('Phone Numbers - Singapore'),
+      'jo_phone' => t('Phone Numbers - Jordan'),
+      'eg_phone' => t('Phone Numbers - Egypt'),
+      'pk_phone' => t('Phone Numbers - Pakistan'),
+      'int_phone'=> t('Phone Numbers - International Phone Numbers per E.123')
+    );
+  }
+
+  return $formats;
+}
