addressfield_tokens.admin.inc 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * @file
  4. * Provides an Administrative UI for the addressfield_tokens module.
  5. */
  6. /**
  7. * Provides a form for configuring regional options for addresses.
  8. *
  9. * @param array $form
  10. * @param array $form_state
  11. * @return array The form.
  12. */
  13. function addressfield_tokens_admin_form($form, &$form_state) {
  14. $options = array('' => t('- None -')) + _addressfield_tokens_countries();
  15. $form['addressfield_tokens_default_country'] = array(
  16. '#type' => 'select',
  17. '#title' => t('Default country'),
  18. '#description' => t('In the city/state views, addresses in this country will not display the country.'),
  19. '#options' => $options,
  20. '#default_value' => addressfield_tokens_default_country(),
  21. );
  22. $form['addressfield_tokens_property_names'] = array(
  23. '#type' => 'fieldset',
  24. '#title' => t('Custom address property names'),
  25. '#description' => t('Change the names of address fields when selecting tokens.'),
  26. '#collapsible' => TRUE,
  27. '#collapsed' => FALSE,
  28. '#tree' => TRUE,
  29. );
  30. $names = addressfield_tokens_property_names();
  31. $props = addressfield_data_property_info();
  32. foreach ($props as $name => $prop) {
  33. $form['addressfield_tokens_property_names'][$name] = array(
  34. '#type' => 'textfield',
  35. '#title' => check_plain($prop['label']),
  36. '#description' => filter_xss($name),
  37. '#default_value' => !empty($names[$name]) ? $names[$name] : $prop['label'],
  38. );
  39. }
  40. return system_settings_form($form);
  41. }