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