Update to Drupal 8.0-dev-2015-11-17. Commits through da81cd220, Tue Nov 17 15:53:49 2015 +0000, Issue #2617224 by Wim Leers: Move around/fix some documentation.

This commit is contained in:
Pantheon Automation 2015-11-17 13:42:33 -08:00 committed by Greg Anderson
parent 4afb23bbd3
commit 7784f4c23d
929 changed files with 19798 additions and 5304 deletions

View file

@ -254,14 +254,24 @@ class DateHelper {
* An array of weekdays.
*
* @return array
* An array of weekdays reordered to match the first day of the week.
* An array of weekdays reordered to match the first day of the week. The
* keys will remain unchanged. For example, if the first day of the week is
* set to be Monday, the array keys will be [1, 2, 3, 4, 5, 6, 0].
*/
public static function weekDaysOrdered($weekdays) {
$first_day = \Drupal::config('system.date')->get('first_day');
if ($first_day > 0) {
for ($i = 1; $i <= $first_day; $i++) {
$last = array_shift($weekdays);
array_push($weekdays, $last);
// Reset the array to the first element.
reset($weekdays);
// Retrieve the first week day value.
$last = current($weekdays);
// Store the corresponding key.
$key = key($weekdays);
// Remove this week day from the beginning of the array.
unset($weekdays[$key]);
// Add this week day to the end of the array.
$weekdays[$key] = $last;
}
}
return $weekdays;