Loading config/schema/office_hours.schema.yml +13 −0 Original line number Diff line number Diff line Loading @@ -89,6 +89,19 @@ field.formatter.settings.office_hours: closed_text: type: label label: 'Currently closed message' exceptions: type: mapping label: 'Exception dates' mapping: restrict_exceptions_to_num_days: type: integer label: 'Restrict exceptions display to x days in future' date_format: type: string label: 'Date format for exception day' title: type: label label: 'Title for exceptions' timezone_field: type: string label: 'Timezone field' Loading src/OfficeHoursFormatterTrait.php +1 −1 Original line number Diff line number Diff line Loading @@ -475,7 +475,7 @@ trait OfficeHoursFormatterTrait { if (!$item->isExceptionDay()) { return TRUE; } if (self::$horizon == NULL) { if (self::$horizon == 0) { // Exceptions settings are not set / submodule is disabled. return FALSE; } Loading src/Plugin/Field/FieldFormatter/OfficeHoursFormatterBase.php +1 −1 Original line number Diff line number Diff line Loading @@ -234,7 +234,7 @@ abstract class OfficeHoursFormatterBase extends FormatterBase { $element['exceptions'] = [ '#title' => $this->t('Exception day handling'), '#type' => 'details', '#open' => TRUE, '#open' => FALSE, ]; // Get the exception date formats. // @todo Use $container->get('entity_type.manager'). Loading src/Plugin/Field/FieldType/OfficeHoursItemList.php +2 −2 Original line number Diff line number Diff line Loading @@ -65,8 +65,8 @@ class OfficeHoursItemList extends FieldItemList implements OfficeHoursItemListIn * {@inheritdoc} */ public function getRows(array $settings, array $field_settings, array $third_party_settings, $time = NULL) { // @todo move more from getRows here, using itemList, not values. $this->keepExceptionDaysInHorizon($settings['exceptions']['restrict_exceptions_to_num_days'] ?? NULL); // @todo Move more from getRows here, using itemList, not values. $this->keepExceptionDaysInHorizon($settings['exceptions']['restrict_exceptions_to_num_days'] ?? 0); return $this->getFieldRows($this->getValue(), $settings, $field_settings, $third_party_settings, $time); } Loading src/Plugin/Field/FieldWidget/OfficeHoursExceptionsWeekWidget.php +1 −1 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ class OfficeHoursExceptionsWeekWidget extends OfficeHoursWeekWidget { $indexed_items[$day][] = $item; } } OfficeHoursDateHelper::weekDaysOrdered($indexed_items); $indexed_items = OfficeHoursDateHelper::weekDaysOrdered($indexed_items); $field_name = $this->fieldDefinition->getName(); // Add more days if we clicked "Add exception". Loading Loading
config/schema/office_hours.schema.yml +13 −0 Original line number Diff line number Diff line Loading @@ -89,6 +89,19 @@ field.formatter.settings.office_hours: closed_text: type: label label: 'Currently closed message' exceptions: type: mapping label: 'Exception dates' mapping: restrict_exceptions_to_num_days: type: integer label: 'Restrict exceptions display to x days in future' date_format: type: string label: 'Date format for exception day' title: type: label label: 'Title for exceptions' timezone_field: type: string label: 'Timezone field' Loading
src/OfficeHoursFormatterTrait.php +1 −1 Original line number Diff line number Diff line Loading @@ -475,7 +475,7 @@ trait OfficeHoursFormatterTrait { if (!$item->isExceptionDay()) { return TRUE; } if (self::$horizon == NULL) { if (self::$horizon == 0) { // Exceptions settings are not set / submodule is disabled. return FALSE; } Loading
src/Plugin/Field/FieldFormatter/OfficeHoursFormatterBase.php +1 −1 Original line number Diff line number Diff line Loading @@ -234,7 +234,7 @@ abstract class OfficeHoursFormatterBase extends FormatterBase { $element['exceptions'] = [ '#title' => $this->t('Exception day handling'), '#type' => 'details', '#open' => TRUE, '#open' => FALSE, ]; // Get the exception date formats. // @todo Use $container->get('entity_type.manager'). Loading
src/Plugin/Field/FieldType/OfficeHoursItemList.php +2 −2 Original line number Diff line number Diff line Loading @@ -65,8 +65,8 @@ class OfficeHoursItemList extends FieldItemList implements OfficeHoursItemListIn * {@inheritdoc} */ public function getRows(array $settings, array $field_settings, array $third_party_settings, $time = NULL) { // @todo move more from getRows here, using itemList, not values. $this->keepExceptionDaysInHorizon($settings['exceptions']['restrict_exceptions_to_num_days'] ?? NULL); // @todo Move more from getRows here, using itemList, not values. $this->keepExceptionDaysInHorizon($settings['exceptions']['restrict_exceptions_to_num_days'] ?? 0); return $this->getFieldRows($this->getValue(), $settings, $field_settings, $third_party_settings, $time); } Loading
src/Plugin/Field/FieldWidget/OfficeHoursExceptionsWeekWidget.php +1 −1 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ class OfficeHoursExceptionsWeekWidget extends OfficeHoursWeekWidget { $indexed_items[$day][] = $item; } } OfficeHoursDateHelper::weekDaysOrdered($indexed_items); $indexed_items = OfficeHoursDateHelper::weekDaysOrdered($indexed_items); $field_name = $this->fieldDefinition->getName(); // Add more days if we clicked "Add exception". Loading