Skip to content
This repository was archived by the owner on Aug 14, 2023. It is now read-only.

Commit f7c1349

Browse files
committed
Merge branch 'development'
2 parents 20baf8e + 7169ef5 commit f7c1349

File tree

193 files changed

+3535
-1275
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

193 files changed

+3535
-1275
lines changed

sites/all/modules/contrib/date/date.field.inc

+27-2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ function date_field_formatter_info() {
2828
'settings' => array(
2929
'interval' => 2,
3030
'interval_display' => 'time ago',
31+
'use_end_date' => false,
3132
),
3233
),
3334
'date_plain' => array(
@@ -207,7 +208,7 @@ function date_field_formatter_view($entity_type, $entity, $field, $instance, $la
207208
$variables['item'] = $item;
208209
$variables['dates'] = date_formatter_process($formatter, $entity_type, $entity, $field, $instance, $langcode, $item, $display);
209210
$variables['attributes'] = !empty($rdf_mapping) ? rdf_rdfa_attributes($rdf_mapping, $item['value']) : array();
210-
$variables['show_remaining_days'] = $display['settings']['show_remaining_days'];
211+
$variables['show_remaining_days'] = isset($display['settings']['show_remaining_days']) ? $display['settings']['show_remaining_days'] : FALSE;
211212
$output = theme('date_display_combination', $variables);
212213
if (!empty($output)) {
213214
$element[$delta] = array('#markup' => $output);
@@ -322,7 +323,7 @@ function date_field_widget_info() {
322323
}
323324

324325
// The date text widget should use an increment of 1.
325-
$info['date_text']['increment'] = 1;
326+
$info['date_text']['settings']['increment'] = 1;
326327

327328
return $info;
328329
}
@@ -462,6 +463,14 @@ function date_field_instance_settings_form($field, $instance) {
462463
return _date_field_instance_settings_form($field, $instance);
463464
}
464465

466+
/**
467+
* Form validation handler for _date_field_instance_settings_form().
468+
*/
469+
function date_field_instance_settings_form_validate(&$form, &$form_state) {
470+
module_load_include('inc', 'date', 'date_admin');
471+
return _date_field_instance_settings_form_validate($form, $form_state);
472+
}
473+
465474
/**
466475
* Implements hook_field_widget_settings_form().
467476
*/
@@ -470,6 +479,14 @@ function date_field_widget_settings_form($field, $instance) {
470479
return _date_field_widget_settings_form($field, $instance);
471480
}
472481

482+
/**
483+
* Form validation handler for _date_field_widget_settings_form().
484+
*/
485+
function date_field_widget_settings_form_validate(&$form, &$form_state) {
486+
module_load_include('inc', 'date', 'date_admin');
487+
return _date_field_widget_settings_form_validate($form, $form_state);
488+
}
489+
473490
/**
474491
* Implements hook_field_settings_form().
475492
*/
@@ -478,6 +495,14 @@ function date_field_settings_form($field, $instance, $has_data) {
478495
return _date_field_settings_form($field, $instance, $has_data);
479496
}
480497

498+
/**
499+
* Form validation handler for _date_field_settings_form().
500+
*/
501+
function date_field_settings_validate(&$form, &$form_state) {
502+
module_load_include('inc', 'date', 'date_admin');
503+
return _date_field_settings_validate($form, $form_state);
504+
}
505+
481506
/**
482507
* Implements hook_content_migrate_field_alter().
483508
*

sites/all/modules/contrib/date/date.info

+4-3
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ files[] = tests/date_validation.test
1313
files[] = tests/date_timezone.test
1414
files[] = tests/date_views_pager.test
1515
files[] = tests/date_views_popup.test
16+
files[] = tests/date_form.test
1617

17-
; Information added by Drupal.org packaging script on 2015-09-08
18-
version = "7.x-2.9"
18+
; Information added by Drupal.org packaging script on 2017-04-07
19+
version = "7.x-2.10"
1920
core = "7.x"
2021
project = "date"
21-
datestamp = "1441727353"
22+
datestamp = "1491562090"
2223

sites/all/modules/contrib/date/date.install

+8
Original file line numberDiff line numberDiff line change
@@ -204,3 +204,11 @@ function date_update_7004() {
204204
field_cache_clear();
205205
drupal_set_message(t('Date text widgets have been updated to use an increment of 1.'));
206206
}
207+
208+
/**
209+
* Revisited: Date text widgets should always use an increment of 1.
210+
*/
211+
function date_update_7005() {
212+
// @see https://www.drupal.org/node/1355256
213+
date_update_7004();
214+
}

sites/all/modules/contrib/date/date.migrate.inc

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
<?php
2-
32
/**
43
* @file
54
* Support for migration into Date fields.
65
*/
76

7+
if (!class_exists('MigrateFieldHandler')) {
8+
return;
9+
}
10+
811
/**
912
* Implements hook_migrate_api().
1013
*/

sites/all/modules/contrib/date/date.module

+6-1
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,12 @@ function date_formatter_format($formatter, $settings, $granularity = array(), $l
443443
return 'date_plain';
444444

445445
default:
446-
$format = date_format_type_format($format_type, $langcode);
446+
if ($format_type == 'custom') {
447+
$format = $settings['custom_date_format'];
448+
}
449+
else {
450+
$format = date_format_type_format($format_type, $langcode);
451+
}
447452
break;
448453
}
449454

sites/all/modules/contrib/date/date.theme

100755100644
+6-4
Original file line numberDiff line numberDiff line change
@@ -349,10 +349,10 @@ function theme_date_display_range($variables) {
349349
}
350350

351351
// Wrap the result with the attributes.
352-
$output = '<div class="date-display-range">' . t('!start-date to !end-date', array(
352+
$output = '<span class="date-display-range">' . t('!start-date to !end-date', array(
353353
'!start-date' => $start_date,
354354
'!end-date' => $end_date,
355-
)) . '</div>';
355+
)) . '</span>';
356356

357357
// Add remaining message and return.
358358
return $output . $show_remaining_days;
@@ -378,6 +378,8 @@ function theme_date_display_interval($variables) {
378378
'end_date' => $dates['value2']['local']['object'],
379379
'interval' => $options['interval'],
380380
'interval_display' => $options['interval_display'],
381+
'use_end_date' => !empty($options['use_end_date']) ?
382+
$options['use_end_date'] : FALSE,
381383
);
382384

383385
if ($return = theme('date_time_ago', $time_ago_vars)) {
@@ -398,9 +400,9 @@ function theme_date_combo($variables) {
398400

399401
// Group start/end items together in fieldset.
400402
$fieldset = array(
401-
'#title' => field_filter_xss(t($element['#title'])) . ' ' . ($element['#delta'] > 0 ? intval($element['#delta'] + 1) : ''),
403+
'#title' => field_filter_xss(t($element['#title'])) . ($element['#delta'] > 0 ? ' ' . intval($element['#delta'] + 1) : ''),
402404
'#value' => '',
403-
'#description' => !empty($element['#fieldset_description']) ? $element['#fieldset_description'] : '',
405+
'#description' => !empty($element['#description']) ? $element['#description'] : '',
404406
'#attributes' => array('class' => array('date-combo')),
405407
'#children' => $element['#children'],
406408
);

sites/all/modules/contrib/date/date_admin.inc

+25-6
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,24 @@ function date_default_formatter_settings_form($field, $instance, $view_mode, $fo
1414
$formatter = $display['type'];
1515
$form = array();
1616

17+
$date_formats = date_format_type_options();
1718
$form['format_type'] = array(
1819
'#title' => t('Choose how users view dates and times:'),
1920
'#type' => 'select',
20-
'#options' => date_format_type_options(),
21+
'#options' => $date_formats + array('custom' => t('Custom')),
2122
'#default_value' => $settings['format_type'],
2223
'#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'))),
2324
'#weight' => 0,
2425
);
2526

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+
2635
$form['fromto'] = array(
2736
'#title' => t('Display:'),
2837
'#type' => 'select',
@@ -116,6 +125,14 @@ function date_interval_formatter_settings_form($field, $instance, $view_mode, $f
116125
'#default_value' => $settings['interval_display'],
117126
'#weight' => 0,
118127
);
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+
}
119136
return $form;
120137
}
121138

@@ -186,7 +203,9 @@ function date_interval_formatter_settings_summary($field, $instance, $view_mode)
186203
$display = $instance['display'][$view_mode];
187204
$settings = $display['settings'];
188205
$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));
190209

191210
return $summary;
192211
}
@@ -273,7 +292,7 @@ function _date_field_instance_settings_form($field, $instance) {
273292
/**
274293
* Form validation handler for _date_field_instance_settings_form().
275294
*/
276-
function date_field_instance_settings_form_validate(&$form, &$form_state) {
295+
function _date_field_instance_settings_form_validate(&$form, &$form_state) {
277296
$settings = $form_state['values']['instance']['settings'];
278297

279298
if ($settings['default_value'] == 'strtotime') {
@@ -459,7 +478,7 @@ function _date_field_widget_settings_form($field, $instance) {
459478
/**
460479
* Form validation handler for _date_field_widget_settings_form().
461480
*/
462-
function date_field_widget_settings_form_validate(&$form, &$form_state) {
481+
function _date_field_widget_settings_form_validate(&$form, &$form_state) {
463482
// The widget settings are in the wrong place in the form because of #tree on
464483
// the top level.
465484
$settings = $form_state['values']['instance']['widget']['settings'];
@@ -561,7 +580,7 @@ function _date_field_settings_form($field, $instance, $has_data) {
561580
$form['cache_enabled'] = array(
562581
'#type' => 'checkbox',
563582
'#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.'),
565584
'#default_value' => !empty($settings['cache_enabled']),
566585
'#weight' => 10,
567586
);
@@ -594,7 +613,7 @@ function _date_field_settings_form($field, $instance, $has_data) {
594613
/**
595614
* Form validation handler for _date_field_settings_form().
596615
*/
597-
function date_field_settings_validate(&$form, &$form_state) {
616+
function _date_field_settings_validate(&$form, &$form_state) {
598617
$field = &$form_state['values']['field'];
599618

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

sites/all/modules/contrib/date/date_all_day/date_all_day.info

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ dependencies[] = date
55
package = Date/Time
66
core = 7.x
77

8-
; Information added by Drupal.org packaging script on 2015-09-08
9-
version = "7.x-2.9"
8+
; Information added by Drupal.org packaging script on 2017-04-07
9+
version = "7.x-2.10"
1010
core = "7.x"
1111
project = "date"
12-
datestamp = "1441727353"
12+
datestamp = "1491562090"
1313

sites/all/modules/contrib/date/date_api/date_api.info

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ stylesheets[all][] = date.css
99
files[] = date_api.module
1010
files[] = date_api_sql.inc
1111

12-
; Information added by Drupal.org packaging script on 2015-09-08
13-
version = "7.x-2.9"
12+
; Information added by Drupal.org packaging script on 2017-04-07
13+
version = "7.x-2.10"
1414
core = "7.x"
1515
project = "date"
16-
datestamp = "1441727353"
16+
datestamp = "1491562090"
1717

sites/all/modules/contrib/date/date_api/date_api.module

+20-6
Original file line numberDiff line numberDiff line change
@@ -1833,9 +1833,10 @@ function date_format_interval($date, $granularity = 2, $display_ago = TRUE) {
18331833
/**
18341834
* A date object for the current time.
18351835
*
1836-
* @param object $timezone
1837-
* (optional) Optionally force time to a specific timezone, defaults to user
1838-
* timezone, if set, otherwise site timezone. Defaults to NULL.
1836+
* @param object|string|null $timezone
1837+
* (optional) PHP DateTimeZone object, string or NULL allowed. Optionally
1838+
* force time to a specific timezone, defaults to user timezone, if set,
1839+
* otherwise site timezone. Defaults to NULL.
18391840
*
18401841
* @param bool $reset
18411842
* (optional) Static cache reset.
@@ -1844,11 +1845,16 @@ function date_format_interval($date, $granularity = 2, $display_ago = TRUE) {
18441845
* The current time as a date object.
18451846
*/
18461847
function date_now($timezone = NULL, $reset = FALSE) {
1848+
$static_var = __FUNCTION__ . $timezone;
1849+
if ($timezone instanceof DateTimeZone) {
1850+
$static_var = __FUNCTION__ . $timezone->getName();
1851+
}
1852+
18471853
if ($reset) {
1848-
drupal_static_reset(__FUNCTION__ . $timezone);
1854+
drupal_static_reset($static_var);
18491855
}
18501856

1851-
$now = &drupal_static(__FUNCTION__ . $timezone);
1857+
$now = &drupal_static($static_var);
18521858

18531859
if (!isset($now)) {
18541860
$now = new DateObject('now', $timezone);
@@ -1920,7 +1926,12 @@ function date_days_in_month($year, $month) {
19201926
// Pick a day in the middle of the month to avoid timezone shifts.
19211927
$datetime = date_pad($year, 4) . '-' . date_pad($month) . '-15 00:00:00';
19221928
$date = new DateObject($datetime);
1923-
return $date->format('t');
1929+
if ($date->errors) {
1930+
return FALSE;
1931+
}
1932+
else {
1933+
return $date->format('t');
1934+
}
19241935
}
19251936

19261937
/**
@@ -2075,6 +2086,9 @@ function date_iso_week_range($week, $year) {
20752086
date_timezone_set($min_date, date_default_timezone_object());
20762087

20772088
// Find the first day of the first ISO week in the year.
2089+
// If it's already a Monday, date_modify won't add a Monday,
2090+
// it will remain the same day. So add a Sunday first, then a Monday.
2091+
date_modify($min_date, '+1 Sunday');
20782092
date_modify($min_date, '+1 Monday');
20792093

20802094
// Jump ahead to the desired week for the beginning of the week range.

sites/all/modules/contrib/date/date_api/date_api_elements.inc

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ function date_default_date($element) {
111111
$format = DATE_FORMAT_DATETIME;
112112

113113
// The text and popup widgets might return less than a full datetime string.
114-
if (strlen($element['#default_value']) < 19) {
114+
if (is_string($element['#default_value']) && strlen($element['#default_value']) < 19) {
115115
switch (strlen($element['#default_value'])) {
116116
case 16:
117117
$format = 'Y-m-d H:i';
@@ -319,7 +319,7 @@ function date_text_element_process($element, &$form_state, $form) {
319319

320320
$element['#tree'] = TRUE;
321321
$element['#theme_wrappers'] = array('date_text');
322-
$element['date']['#value'] = $element['#value']['date'];
322+
$element['date']['#value'] = isset($element['#value']['date']) ? $element['#value']['date'] : '';
323323
$element['date']['#type'] = 'textfield';
324324
$element['date']['#weight'] = !empty($element['date']['#weight']) ? $element['date']['#weight'] : $element['#weight'];
325325
$element['date']['#attributes'] = array('class' => isset($element['#attributes']['class']) ? $element['#attributes']['class'] += array('date-date') : array('date-date'));

sites/all/modules/contrib/date/date_api/theme/theme.inc

+11-2
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ function theme_date_calendar_day($variables) {
194194
function theme_date_time_ago($variables) {
195195
$start_date = $variables['start_date'];
196196
$end_date = $variables['end_date'];
197+
$use_end_date = isset($variables['use_end_date']) ? $variables['use_end_date'] : false;
197198
$interval = !empty($variables['interval']) ? $variables['interval'] : 2;
198199
$display = isset($variables['interval_display']) ? $variables['interval_display'] : 'time ago';
199200

@@ -202,12 +203,20 @@ function theme_date_time_ago($variables) {
202203
return;
203204
}
204205

206+
// We use the end date only when the option is checked.
207+
if ($use_end_date){
208+
$date = date_format($end_date, DATE_FORMAT_UNIX);
209+
}
210+
else {
211+
$date = date_format($start_date, DATE_FORMAT_UNIX);
212+
}
213+
205214
// Time to compare dates to.
215+
206216
$now = date_format(date_now(), DATE_FORMAT_UNIX);
207-
$start = date_format($start_date, DATE_FORMAT_UNIX);
208217

209218
// Will be positive for a datetime in the past (ago), and negative for a datetime in the future (hence).
210-
$time_diff = $now - $start;
219+
$time_diff = $now - $date;
211220

212221
// Uses the same options used by Views format_interval.
213222
switch ($display) {

sites/all/modules/contrib/date/date_context/date_context.info

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ dependencies[] = context
88

99
files[] = date_context.module
1010
files[] = plugins/date_context_date_condition.inc
11-
; Information added by Drupal.org packaging script on 2015-09-08
12-
version = "7.x-2.9"
11+
; Information added by Drupal.org packaging script on 2017-04-07
12+
version = "7.x-2.10"
1313
core = "7.x"
1414
project = "date"
15-
datestamp = "1441727353"
15+
datestamp = "1491562090"
1616

0 commit comments

Comments
 (0)