Projet

Général

Profil

Révision ee46a8ed

Ajouté par Assos Assos il y a plus de 7 ans

Update date 7.x-2.9 -> 7.x-2.10-rc1

Voir les différences:

drupal7/sites/all/modules/date/date_admin.inc
14 14
  $formatter = $display['type'];
15 15
  $form = array();
16 16

  
17
  $date_formats = date_format_type_options();
17 18
  $form['format_type'] = array(
18 19
    '#title' => t('Choose how users view dates and times:'),
19 20
    '#type' => 'select',
20
    '#options' => date_format_type_options(),
21
    '#options' => $date_formats + array('custom' => t('Custom')),
21 22
    '#default_value' => $settings['format_type'],
22 23
    '#description' => t('To add or edit options, visit <a href="@date-time-page">Date and time settings</a>.', array('@date-time-page' => url('admin/config/regional/date-time'))),
23 24
    '#weight' => 0,
24 25
  );
25 26

  
27
  $form['custom_date_format'] = array(
28
    '#type' => 'textfield',
29
    '#title' => t('Custom date format'),
30
    '#description' => t('If "Custom", see the <a href="@url" target="_blank">PHP manual</a> for date formats. Otherwise, enter the number of different time units to display, which defaults to 2.', array('@url' => 'http://php.net/manual/function.date.php')),
31
    '#default_value' => isset($settings['custom_date_format']) ? $settings['custom_date_format'] : '',
32
    '#dependency' => array('edit-options-settings-format-type' => array('custom')),
33
  );
34

  
26 35
  $form['fromto'] = array(
27 36
    '#title' => t('Display:'),
28 37
    '#type' => 'select',
......
116 125
    '#default_value' => $settings['interval_display'],
117 126
    '#weight' => 0,
118 127
  );
128
  if (!empty($field['settings']['todate'])) {
129
    $form['use_end_date'] = array(
130
      '#title' => t('Use End date'),
131
      '#description' => 'Use the End date, instead of the start date',
132
      '#type' => 'checkbox',
133
      '#default_value' => $settings['use_end_date'],
134
    );
135
  }
119 136
  return $form;
120 137
}
121 138

  
......
186 203
  $display = $instance['display'][$view_mode];
187 204
  $settings = $display['settings'];
188 205
  $formatter = $display['type'];
189
  $summary[] = t('Display time ago, showing @interval units.', array('@interval' => $settings['interval']));
206
  $field = ($settings['use_end_date'] == 1) ? 'End' : 'Start';
207
  $summary[] = t('Display time ago, showing @interval units. Using @field Date',
208
      array('@interval' => $settings['interval'], '@field' => $field));
190 209

  
191 210
  return $summary;
192 211
}
......
273 292
/**
274 293
 * Form validation handler for _date_field_instance_settings_form().
275 294
 */
276
function date_field_instance_settings_form_validate(&$form, &$form_state) {
295
function _date_field_instance_settings_form_validate(&$form, &$form_state) {
277 296
  $settings = $form_state['values']['instance']['settings'];
278 297

  
279 298
  if ($settings['default_value'] == 'strtotime') {
......
459 478
/**
460 479
 * Form validation handler for _date_field_widget_settings_form().
461 480
 */
462
function date_field_widget_settings_form_validate(&$form, &$form_state) {
481
function _date_field_widget_settings_form_validate(&$form, &$form_state) {
463 482
  // The widget settings are in the wrong place in the form because of #tree on
464 483
  // the top level.
465 484
  $settings = $form_state['values']['instance']['widget']['settings'];
......
561 580
  $form['cache_enabled'] = array(
562 581
    '#type' => 'checkbox',
563 582
    '#title' => t('Cache dates'),
564
    '#description' => t('Date objects can be created and cached as date fields are loaded rather than when they are displayed to improve performance.'),
583
    '#description' => t('Date objects can be created and cached as date fields are loaded, rather than when they are displayed, to improve performance.'),
565 584
    '#default_value' => !empty($settings['cache_enabled']),
566 585
    '#weight' => 10,
567 586
  );
......
594 613
/**
595 614
 * Form validation handler for _date_field_settings_form().
596 615
 */
597
function date_field_settings_validate(&$form, &$form_state) {
616
function _date_field_settings_validate(&$form, &$form_state) {
598 617
  $field = &$form_state['values']['field'];
599 618

  
600 619
  if ($field['settings']['tz_handling'] == 'none') {

Formats disponibles : Unified diff