Update to Drupal 8.0.0 beta 14. For more information, see https://drupal.org/node/2544542

This commit is contained in:
Pantheon Automation 2015-08-27 12:03:05 -07:00 committed by Greg Anderson
parent 3b2511d96d
commit 81ccda77eb
2155 changed files with 54307 additions and 46870 deletions

View file

@ -204,6 +204,11 @@ class DateFormatter {
$interval %= $value;
$granularity--;
}
elseif ($output) {
// Break if there was previous output but not any output at this level,
// to avoid skipping levels and getting output like "1 year 1 second".
break;
}
if ($granularity == 0) {
break;
@ -373,15 +378,21 @@ class DateFormatter {
// ourselves.
$interval_output = '';
$days = $interval->d;
if ($days >= 7) {
$weeks = floor($days / 7);
$weeks = floor($days / 7);
if ($weeks) {
$interval_output .= $this->formatPlural($weeks, '1 week', '@count weeks', array(), array('langcode' => $options['langcode']));
$days -= $weeks * 7;
$granularity--;
}
if ($granularity > 0 && $days > 0) {
if ((!$output || $weeks > 0) && $granularity > 0 && $days > 0) {
$interval_output .= ($interval_output ? ' ' : '') . $this->formatPlural($days, '1 day', '@count days', array(), array('langcode' => $options['langcode']));
}
else {
// If we did not output days, set the granularity to 0 so that we
// will not output hours and get things like "1 week 1 hour".
$granularity = 0;
}
break;
case 'h':
@ -397,9 +408,14 @@ class DateFormatter {
break;
}
$output .= ($output ? ' ' : '') . $interval_output;
$output .= ($output && $interval_output ? ' ' : '') . $interval_output;
$granularity--;
}
elseif ($output) {
// Break if there was previous output but not any output at this level,
// to avoid skipping levels and getting output like "1 year 1 second".
break;
}
if ($granularity <= 0) {
break;

View file

@ -335,10 +335,10 @@ class Datelist extends DateElementBase {
protected static function incrementRound(&$date, $increment) {
// Round minutes and seconds, if necessary.
if ($date instanceOf DrupalDateTime && $increment > 1) {
$day = intval(date_format($date, 'j'));
$hour = intval(date_format($date, 'H'));
$second = intval(round(intval(date_format($date, 's')) / $increment) * $increment);
$minute = intval(date_format($date, 'i'));
$day = intval($date->format('j'));
$hour = intval($date->format('H'));
$second = intval(round(intval($date->format('s')) / $increment) * $increment);
$minute = intval($date->format('i'));
if ($second == 60) {
$minute += 1;
$second = 0;
@ -348,12 +348,12 @@ class Datelist extends DateElementBase {
$hour += 1;
$minute = 0;
}
date_time_set($date, $hour, $minute, $second);
$date->setTime($hour, $minute, $second);
if ($hour == 24) {
$day += 1;
$year = date_format($date, 'Y');
$month = date_format($date, 'n');
date_date_set($date, $year, $month, $day);
$year = $date->format('Y');
$month = $date->format('n');
$date->setDate($year, $month, $day);
}
}
return $date;

View file

@ -268,6 +268,7 @@ class Datetime extends DateElementBase {
'#required' => $element['#required'],
'#size' => max(12, strlen($element['#value']['date'])),
'#error_no_message' => TRUE,
'#date_date_format' => $element['#date_date_format'],
);
// Allows custom callbacks to alter the element.

View file

@ -41,14 +41,14 @@ class DateFormat extends ConfigEntityBase implements DateFormatInterface {
*
* @var string
*/
public $id;
protected $id;
/**
* The human-readable name of the date format entity.
*
* @var string
*/
public $label;
protected $label;
/**
* The date format pattern.
@ -101,7 +101,7 @@ class DateFormat extends ConfigEntityBase implements DateFormatInterface {
/**
* {@inheritdoc}
*/
public function getCacheTags() {
public function getCacheTagsToInvalidate() {
return ['rendered'];
}