You are here

protected function OfficeHoursFormatterTrait::keepOpenDays in Office Hours 8

Formatter: remove closed days, keeping open days.

Parameters

array $office_hours: Office hours array.

Return value

array Reformatted office hours array.

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

File

src/OfficeHoursFormatterTrait.php, line 224

Class

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

Namespace

Drupal\office_hours

Code

protected function keepOpenDays(array $office_hours) {
  $new_office_hours = [];
  foreach ($office_hours as $day => $info) {
    if (!empty($info['slots'])) {
      $new_office_hours[] = $info;
    }
  }
  return $new_office_hours;
}