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_popup/date_popup.module
394 394
    'fromTo' => isset($fromto),
395 395
  );
396 396

  
397
  if (!empty($element['#instance'])) {
398
    $settings['syncEndDate'] = $element['#instance']['settings']['default_value2'] == 'sync';
399
  }
400

  
397 401
  // Create a unique id for each set of custom settings.
398 402
  $id = date_popup_js_settings_id($element['#id'], 'datepicker', $settings);
399 403

  
......
474 478
      $grans = array('hour', 'minute', 'second');
475 479
      $time_granularity = array_intersect($granularity, $grans);
476 480
      $format = date_popup_format_to_popup_time(date_limit_format($element['#date_format'], $time_granularity), 'wvega');
481
      $default_value = isset($element['#default_value']) ? $element['#default_value'] : '';
477 482
      // The first value in the dropdown list should be the same as the element
478 483
      // default_value, but it needs to be in JS format (i.e. milliseconds since
479 484
      // the epoch).
480
      $start_time = new DateObject($element['#default_value'], $element['#date_timezone'], DATE_FORMAT_DATETIME);
485
      $start_time = new DateObject($default_value, $element['#date_timezone'], DATE_FORMAT_DATETIME);
481 486
      date_increment_round($start_time, $element['#date_increment']);
482 487
      $start_time = $start_time->format(DATE_FORMAT_UNIX) * 1000;
483 488
      $settings = array(
......
800 805
  return '<div ' . drupal_attributes($attributes) . '>' . theme('form_element', $element) . '</div>';
801 806
}
802 807

  
808
/**
809
 * Implements hook_date_field_instance_settings_form_alter().
810
 */
811
function date_popup_date_field_instance_settings_form_alter(&$form, $context) {
812
  // Add an extra option to sync the end date with the start date.
813
  $form['default_value2']['#options']['sync'] = t('Sync with start date');
814
}
815

  
803 816
/**
804 817
 * Implements hook_menu().
805 818
 */

Formats disponibles : Unified diff