You are here

protected function OfficeHoursFormatterTrait::keepNextDay in Office Hours 8

Formatter: remove all days, except the first open day.

Parameters

array $office_hours: Office hours array.

Return value

array Reformatted office hours array.

1 call to OfficeHoursFormatterTrait::keepNextDay()
OfficeHoursFormatterTrait::getRows in src/OfficeHoursFormatterTrait.php
Returns the items of a field.

File

src/OfficeHoursFormatterTrait.php, line 243

Class

OfficeHoursFormatterTrait
Factors out OfficeHoursItemList->getItems()->getRows().

Namespace

Drupal\office_hours

Code

protected function keepNextDay(array $office_hours) {
  $new_office_hours = [];
  foreach ($office_hours as $day => $info) {
    if ($info['current'] || $info['next']) {
      $new_office_hours[$day] = $info;
    }
  }
  return $new_office_hours;
}