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