Révision 599a39cd
Ajouté par Assos Assos il y a environ 3 ans
drupal7/sites/all/modules/date/date_tools/date_tools.wizard.inc | ||
---|---|---|
7 | 7 |
|
8 | 8 |
/** |
9 | 9 |
* Implements hook_form(). |
10 |
* |
|
11 |
* @todo. |
|
12 | 10 |
*/ |
13 | 11 |
function date_tools_wizard_form() { |
14 | 12 |
$form = array(); |
... | ... | |
112 | 110 |
'#title' => t('Date timezone handling'), |
113 | 111 |
'#description' => t("Timezone handling should be set to 'none' for granularity without time elements."), |
114 | 112 |
); |
113 |
$form['field']['advanced']['weight'] = array( |
|
114 |
'#type' => 'textfield', |
|
115 |
'#default_value' => '-4', |
|
116 |
'#title' => t('Weight'), |
|
117 |
'#description' => t("Set the field weight."), |
|
118 |
); |
|
115 | 119 |
$form['calendar'] = array( |
116 | 120 |
'#type' => 'select', |
117 | 121 |
'#default_value' => module_exists('calendar'), |
... | ... | |
131 | 135 |
} |
132 | 136 |
|
133 | 137 |
/** |
134 |
* Form validate. |
|
135 |
* |
|
136 |
* @todo. |
|
138 |
* Form validation. |
|
137 | 139 |
*/ |
138 | 140 |
function date_tools_wizard_form_validate(&$form, &$form_state) { |
139 | 141 |
$bundle = $form_state['values']['bundle']; |
... | ... | |
173 | 175 |
|
174 | 176 |
/** |
175 | 177 |
* Form submit. |
176 |
* |
|
177 |
* @todo. |
|
178 | 178 |
*/ |
179 | 179 |
function date_tools_wizard_form_submit(&$form, &$form_state) { |
180 | 180 |
$view_name = date_tools_wizard_build($form_state['values']); |
... | ... | |
189 | 189 |
|
190 | 190 |
/** |
191 | 191 |
* Wizard build. |
192 |
* |
|
193 |
* @todo. |
|
194 | 192 |
*/ |
195 | 193 |
function date_tools_wizard_build($form_values) { |
196 | 194 |
extract($form_values); |
... | ... | |
198 | 196 |
$field_name = 'field_' . $field_name; |
199 | 197 |
$base_table = 'node'; |
200 | 198 |
|
201 |
// Create a node type if it doesn't already exist. |
|
202 |
// This makes it possible to add additional date fields to |
|
203 |
// an existing type. |
|
199 |
// Create a node type if it doesn't already exist. This makes it possible to |
|
200 |
// add additional date fields to an existing type. |
|
204 | 201 |
$types = node_type_get_names(); |
205 | 202 |
$type_settings = array(); |
206 | 203 |
if (!array_key_exists($bundle, $types)) { |
... | ... | |
238 | 235 |
'label' => $label, |
239 | 236 |
'bundle' => $bundle, |
240 | 237 |
// Move the date right below the title. |
241 |
'weight' => -4,
|
|
238 |
'weight' => $weight,
|
|
242 | 239 |
'widget' => array( |
243 | 240 |
'type' => $widget_type, |
244 | 241 |
// Increment for minutes and seconds, can be 1, 5, 10, 15, or 30. |
... | ... | |
252 | 249 |
'label_position' => 'above', |
253 | 250 |
'repeat_collapsed' => 0, |
254 | 251 |
), |
255 |
'weight' => -4,
|
|
252 |
'weight' => $weight,
|
|
256 | 253 |
), |
257 | 254 |
'settings' => array( |
258 | 255 |
'default_value' => 'now', |
... | ... | |
295 | 292 |
$instance = field_create_instance($instance); |
296 | 293 |
$view_name = 'calendar_node_' . $field_name; |
297 | 294 |
|
298 |
field_info_cache_clear(TRUE);
|
|
299 |
field_cache_clear(TRUE);
|
|
295 |
field_info_cache_clear(); |
|
296 |
field_cache_clear(); |
|
300 | 297 |
|
301 | 298 |
drupal_set_message(t('Your date field @name has been created.', array('@name' => $label))); |
302 | 299 |
|
... | ... | |
305 | 302 |
|
306 | 303 |
/** |
307 | 304 |
* Includes handler. |
308 |
* |
|
309 |
* @todo. |
|
310 | 305 |
*/ |
311 | 306 |
function date_tools_wizard_include() { |
312 | 307 |
module_load_include('inc', 'node', 'content_types'); |
... | ... | |
317 | 312 |
|
318 | 313 |
/** |
319 | 314 |
* Implements hook_field_types(). |
320 |
* |
|
321 |
* @todo. |
|
322 | 315 |
*/ |
323 | 316 |
function date_tools_wizard_field_types() { |
324 | 317 |
$field_types = array(); |
... | ... | |
330 | 323 |
|
331 | 324 |
/** |
332 | 325 |
* Implements hook_widget_types(). |
333 |
* @todo. |
|
334 | 326 |
*/ |
335 | 327 |
function date_tools_wizard_widget_types() { |
336 | 328 |
$widget_types = array(); |
... | ... | |
344 | 336 |
|
345 | 337 |
/** |
346 | 338 |
* Tz handler. |
347 |
* |
|
348 |
* @todo. |
|
349 | 339 |
*/ |
350 | 340 |
function date_tools_wizard_tz_handling() { |
351 | 341 |
include_once drupal_get_path('module', 'date') . '/date_admin.inc'; |
... | ... | |
354 | 344 |
|
355 | 345 |
/** |
356 | 346 |
* Create date tools wizard content type. |
357 |
* |
|
358 |
* @todo. |
|
359 | 347 |
*/ |
360 | 348 |
function date_tools_wizard_create_content_type($name, $bundle, $description, $type_settings = array()) { |
361 |
|
|
362 | 349 |
date_tools_wizard_include(); |
363 | 350 |
|
364 | 351 |
// Create the content type. |
... | ... | |
427 | 414 |
), |
428 | 415 |
); |
429 | 416 |
field_create_instance($instance); |
430 |
|
|
431 | 417 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules