You are here

function uc_addresses_country_formats_form in Ubercart Addresses 6.2

Same name and namespace in other branches
  1. 7 uc_addresses.admin.inc \uc_addresses_country_formats_form()

Form for address format.

Parameters

int $country_id: The ID of the country to set a format for.

Return value

array The form definition.

1 string reference to 'uc_addresses_country_formats_form'
uc_addresses_country_formats_page in ./uc_addresses.admin.inc
Lists all enabled countries were address formats may be set for.

File

./uc_addresses.admin.inc, line 194
Admin settings for Ubercart Addresses.

Code

function uc_addresses_country_formats_form($form_state, $country_id) {

  // Get country.
  $result = db_query("SELECT country_name FROM {uc_countries} WHERE country_id = %d", $country_id);
  $country = db_fetch_object($result);
  if (!isset($country->country_name)) {
    return;
  }
  $form = array();
  $form['uc_addresses_address_format_' . $country_id] = array(
    '#type' => 'textarea',
    '#title' => t('Address format for @country', array(
      '@country' => t($country->country_name),
    )),
    '#default_value' => uc_addresses_get_address_format($country_id),
    '#description' => t('Uses tokens to format an address for this country.'),
    '#rows' => 6,
  );
  $form['token_help'] = array(
    '#type' => 'fieldset',
    '#title' => t('Replacement patterns'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#children' => theme('token_tree', array(
      'uc_addresses',
    )),
  );
  $form = system_settings_form($form);
  return $form;
}