Révision b720ea3e
Ajouté par Assos Assos il y a plus de 8 ans
drupal7/sites/all/modules/date/date_tools/date_tools.wizard.inc | ||
---|---|---|
6 | 6 |
*/ |
7 | 7 |
|
8 | 8 |
/** |
9 |
* Implements hook_form(). |
|
10 |
* |
|
9 | 11 |
* @todo. |
10 | 12 |
*/ |
11 | 13 |
function date_tools_wizard_form() { |
... | ... | |
59 | 61 |
$form['field']['repeat'] = array( |
60 | 62 |
'#type' => 'select', |
61 | 63 |
'#default_value' => 0, |
62 |
'#options' => array(0 => t('No'), 1 => t('Yes')), |
|
64 |
'#options' => array( |
|
65 |
0 => t('No'), |
|
66 |
1 => t('Yes'), |
|
67 |
), |
|
63 | 68 |
'#title' => t('Show repeating date options'), |
64 | 69 |
'#access' => module_exists('date_repeat_field'), |
65 | 70 |
); |
... | ... | |
72 | 77 |
$form['field']['advanced']['todate'] = array( |
73 | 78 |
'#type' => 'select', |
74 | 79 |
'#default_value' => 'optional', |
75 |
'#options' => array('' => t('Never'), 'optional' => t('Optional'), 'required' => t('Required')), |
|
80 |
'#options' => array( |
|
81 |
'' => t('Never'), |
|
82 |
'optional' => t('Optional'), |
|
83 |
'required' => t('Required'), |
|
84 |
), |
|
76 | 85 |
'#title' => t('End Date'), |
77 | 86 |
'#description' => t("Display a matching second date field as a 'End date'."), |
78 | 87 |
); |
... | ... | |
106 | 115 |
$form['calendar'] = array( |
107 | 116 |
'#type' => 'select', |
108 | 117 |
'#default_value' => module_exists('calendar'), |
109 |
'#options' => array(0 => t('No'), 1 => t('Yes')), |
|
118 |
'#options' => array( |
|
119 |
0 => t('No'), |
|
120 |
1 => t('Yes'), |
|
121 |
), |
|
110 | 122 |
'#title' => t('Create a calendar for this date field'), |
111 | 123 |
'#access' => module_exists('calendar'), |
112 | 124 |
); |
... | ... | |
119 | 131 |
} |
120 | 132 |
|
121 | 133 |
/** |
134 |
* Form validate. |
|
135 |
* |
|
122 | 136 |
* @todo. |
123 | 137 |
*/ |
124 | 138 |
function date_tools_wizard_form_validate(&$form, &$form_state) { |
125 | 139 |
$bundle = $form_state['values']['bundle']; |
126 | 140 |
$field_name = 'field_' . $form_state['values']['field_name']; |
127 |
$existing_type = db_query("SELECT type FROM {node_type} WHERE type=:bundle", array(':bundle' => $bundle))->fetchField(); |
|
128 |
$existing_instance = db_query("SELECT field_name FROM {field_config_instance} WHERE field_name=:field_name AND bundle=:bundle AND entity_type=:entity_type", array(':field_name' => $field_name, ':bundle' => $bundle, ':entity_type' => 'node'))->fetchField(); |
|
141 |
|
|
142 |
$args = array( |
|
143 |
':field_name' => $field_name, |
|
144 |
':bundle' => $bundle, |
|
145 |
':entity_type' => 'node', |
|
146 |
); |
|
147 |
|
|
148 |
$query = "SELECT type FROM {node_type} WHERE type=:bundle"; |
|
149 |
$existing_type = db_query($query, array(':bundle' => $args[':bundle']))->fetchField(); |
|
150 |
|
|
151 |
$query = "SELECT field_name FROM {field_config_instance} WHERE field_name=:field_name AND bundle=:bundle AND entity_type=:entity_type"; |
|
152 |
$existing_instance = db_query($query, $args)->fetchField(); |
|
153 |
|
|
129 | 154 |
if ($existing_type) { |
130 | 155 |
drupal_set_message(t('This content type name already exists, adding new field to existing content type.')); |
131 | 156 |
} |
... | ... | |
147 | 172 |
} |
148 | 173 |
|
149 | 174 |
/** |
175 |
* Form submit. |
|
176 |
* |
|
150 | 177 |
* @todo. |
151 | 178 |
*/ |
152 | 179 |
function date_tools_wizard_form_submit(&$form, &$form_state) { |
... | ... | |
161 | 188 |
} |
162 | 189 |
|
163 | 190 |
/** |
191 |
* Wizard build. |
|
192 |
* |
|
164 | 193 |
* @todo. |
165 | 194 |
*/ |
166 | 195 |
function date_tools_wizard_build($form_values) { |
... | ... | |
201 | 230 |
'timezone_db' => date_get_timezone_db($tz_handling), |
202 | 231 |
'repeat' => $repeat, |
203 | 232 |
'todate' => !empty($todate) ? $todate : 'optional', |
204 |
),
|
|
233 |
), |
|
205 | 234 |
); |
206 | 235 |
$instance = array( |
207 | 236 |
'entity_type' => 'node', |
... | ... | |
275 | 304 |
} |
276 | 305 |
|
277 | 306 |
/** |
307 |
* Includes handler. |
|
308 |
* |
|
278 | 309 |
* @todo. |
279 | 310 |
*/ |
280 | 311 |
function date_tools_wizard_include() { |
... | ... | |
285 | 316 |
} |
286 | 317 |
|
287 | 318 |
/** |
319 |
* Implements hook_field_types(). |
|
320 |
* |
|
288 | 321 |
* @todo. |
289 | 322 |
*/ |
290 | 323 |
function date_tools_wizard_field_types() { |
... | ... | |
296 | 329 |
} |
297 | 330 |
|
298 | 331 |
/** |
332 |
* Implements hook_widget_types(). |
|
299 | 333 |
* @todo. |
300 | 334 |
*/ |
301 | 335 |
function date_tools_wizard_widget_types() { |
... | ... | |
309 | 343 |
} |
310 | 344 |
|
311 | 345 |
/** |
346 |
* Tz handler. |
|
347 |
* |
|
312 | 348 |
* @todo. |
313 | 349 |
*/ |
314 | 350 |
function date_tools_wizard_tz_handling() { |
... | ... | |
317 | 353 |
} |
318 | 354 |
|
319 | 355 |
/** |
356 |
* Create date tools wizard content type. |
|
357 |
* |
|
320 | 358 |
* @todo. |
321 | 359 |
*/ |
322 | 360 |
function date_tools_wizard_create_content_type($name, $bundle, $description, $type_settings = array()) { |
... | ... | |
332 | 370 |
'body_label' => 'Body', |
333 | 371 |
'min_word_count' => '0', |
334 | 372 |
'help' => '', |
335 |
'node_options' => |
|
336 |
array( |
|
373 |
'node_options' => array( |
|
337 | 374 |
'status' => 1, |
338 | 375 |
'promote' => 1, |
339 | 376 |
'sticky' => 0, |
... | ... | |
374 | 411 |
'weight' => -4, |
375 | 412 |
'module' => 'text', |
376 | 413 |
), |
377 |
'settings' => array('display_summary' => TRUE), |
|
378 |
'display' => array( |
|
414 |
'settings' => array( |
|
415 |
'display_summary' => TRUE, |
|
416 |
), |
|
417 |
'display' => array( |
|
379 | 418 |
'default' => array( |
380 | 419 |
'label' => 'hidden', |
381 | 420 |
'type' => 'text_default', |
Formats disponibles : Unified diff
Weekly update of contrib modules