webform.options.inc 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <?php
  2. /**
  3. * @file
  4. * A collection of built-in select list options for Webform.
  5. */
  6. /**
  7. * Private implementation of hook_webform_select_options_info().
  8. *
  9. * @see webform_webform_select_options_info()
  10. */
  11. function _webform_options_info() {
  12. $items = array();
  13. $items['days'] = array(
  14. 'title' => t('Days of the week'),
  15. 'options callback' => 'webform_options_days',
  16. 'file' => 'includes/webform.options.inc',
  17. );
  18. $items['countries'] = array(
  19. 'title' => t('Countries'),
  20. 'options callback' => 'webform_options_countries',
  21. 'file' => 'includes/webform.options.inc',
  22. );
  23. $items['united_states'] = array(
  24. 'title' => t('US states'),
  25. 'options callback' => 'webform_options_united_states',
  26. 'file' => 'includes/webform.options.inc',
  27. );
  28. return $items;
  29. }
  30. /**
  31. * Option list containing the days of the week.
  32. */
  33. function webform_options_days($component, $flat, $filter, $arguments) {
  34. $days = array(
  35. 'sunday' => t('Sunday'),
  36. 'monday' => t('Monday'),
  37. 'tuesday' => t('Tuesday'),
  38. 'wednesday' => t('Wednesday'),
  39. 'thursday' => t('Thursday'),
  40. 'friday' => t('Friday'),
  41. 'saturday' => t('Saturday'),
  42. );
  43. // Order according to site settings for first day.
  44. if ($first_day = variable_get('date_first_day', 0)) {
  45. $week = array_splice($days, $first_day);
  46. $days = array_merge($week, $days);
  47. }
  48. return $days;
  49. }
  50. /**
  51. * Options list containing country names.
  52. */
  53. function webform_options_countries($component, $flat, $filter, $arguments) {
  54. include_once DRUPAL_ROOT . '/includes/locale.inc';
  55. return country_get_list();
  56. }
  57. /**
  58. * Options list containing United States states and territories.
  59. */
  60. function webform_options_united_states($component, $flat, $filter, $arguments) {
  61. return array(
  62. 'AL' => t('Alabama'),
  63. 'AK' => t('Alaska'),
  64. 'AS' => t('American Samoa'),
  65. 'AZ' => t('Arizona'),
  66. 'AR' => t('Arkansas'),
  67. 'CA' => t('California'),
  68. 'CO' => t('Colorado'),
  69. 'CT' => t('Connecticut'),
  70. 'DE' => t('Delaware'),
  71. 'DC' => t('District of Columbia'),
  72. 'FL' => t('Florida'),
  73. 'GA' => t('Georgia'),
  74. 'GU' => t('Guam'),
  75. 'HI' => t('Hawaii'),
  76. 'ID' => t('Idaho'),
  77. 'IL' => t('Illinois'),
  78. 'IN' => t('Indiana'),
  79. 'IA' => t('Iowa'),
  80. 'KS' => t('Kansas'),
  81. 'KY' => t('Kentucky'),
  82. 'LA' => t('Louisiana'),
  83. 'ME' => t('Maine'),
  84. 'MH' => t('Marshall Islands'),
  85. 'MD' => t('Maryland'),
  86. 'MA' => t('Massachusetts'),
  87. 'MI' => t('Michigan'),
  88. 'MN' => t('Minnesota'),
  89. 'MS' => t('Mississippi'),
  90. 'MO' => t('Missouri'),
  91. 'MT' => t('Montana'),
  92. 'NE' => t('Nebraska'),
  93. 'NV' => t('Nevada'),
  94. 'NH' => t('New Hampshire'),
  95. 'NJ' => t('New Jersey'),
  96. 'NM' => t('New Mexico'),
  97. 'NY' => t('New York'),
  98. 'NC' => t('North Carolina'),
  99. 'ND' => t('North Dakota'),
  100. 'MP' => t('Northern Marianas Islands'),
  101. 'OH' => t('Ohio'),
  102. 'OK' => t('Oklahoma'),
  103. 'OR' => t('Oregon'),
  104. 'PW' => t('Palau'),
  105. 'PA' => t('Pennsylvania'),
  106. 'PR' => t('Puerto Rico'),
  107. 'RI' => t('Rhode Island'),
  108. 'SC' => t('South Carolina'),
  109. 'SD' => t('South Dakota'),
  110. 'TN' => t('Tennessee'),
  111. 'TX' => t('Texas'),
  112. 'UT' => t('Utah'),
  113. 'VT' => t('Vermont'),
  114. 'VI' => t('Virgin Islands'),
  115. 'VA' => t('Virginia'),
  116. 'WA' => t('Washington'),
  117. 'WV' => t('West Virginia'),
  118. 'WI' => t('Wisconsin'),
  119. 'WY' => t('Wyoming'),
  120. );
  121. }