| 1 |
<?php
|
| 2 |
// $Id: site_country.module,v 1.1.2.4 2008/11/12 14:21:17 snpower Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* Helper module to add support to Drupal for a site default country.
|
| 7 |
*/
|
| 8 |
|
| 9 |
/**
|
| 10 |
* Implementation of hook_boot().
|
| 11 |
*
|
| 12 |
* This function is present so other modules requiring this one during bootstrap
|
| 13 |
* can use its functions.
|
| 14 |
*/
|
| 15 |
function site_country_boot() {
|
| 16 |
}
|
| 17 |
|
| 18 |
/**
|
| 19 |
* Implementation of hook_form_alter().
|
| 20 |
*
|
| 21 |
* Show site default country setting on 'site information' config form.
|
| 22 |
*/
|
| 23 |
function site_country_form_system_site_information_settings_alter(&$form, $form_state) {
|
| 24 |
$countries = site_country_country_list();
|
| 25 |
$form['site_country_default_country'] = array(
|
| 26 |
'#type' => 'select',
|
| 27 |
'#title' => t('Default country'),
|
| 28 |
'#default_value' => variable_get('site_country_default_country', ''),
|
| 29 |
'#options' => $countries,
|
| 30 |
'#description' => t('Select the default country for the site.'),
|
| 31 |
);
|
| 32 |
$form['buttons']['#weight'] = 2;
|
| 33 |
}
|
| 34 |
|
| 35 |
/**
|
| 36 |
* Get an array of all country code => country name pairs.
|
| 37 |
*
|
| 38 |
* @return
|
| 39 |
* An array of all country code => country name pairs.
|
| 40 |
*/
|
| 41 |
function site_country_country_list() {
|
| 42 |
// drupal_get_path() is not declared yet.
|
| 43 |
$path = dirname(__FILE__) . '/site_country_country_list.inc';
|
| 44 |
include_once($path);
|
| 45 |
return _site_country_country_list();
|
| 46 |
}
|
| 47 |
|