From 395b08ab2f1fedf064bf3504731600df2a76f509 Mon Sep 17 00:00:00 2001
From: Eric Bremner <ebremner@uwaterloo.ca>
Date: Fri, 21 Jan 2022 19:41:52 +0000
Subject: [PATCH] ISTWCMS-5313: Update fields for office_hours_exceptions

---
 ...orm_display.node.uw_ct_service.default.yml | 169 +++++++++---------
 ...view_display.node.uw_ct_service.teaser.yml |  45 ++++-
 ...ld.storage.node.field_uw_service_hours.yml |  10 +-
 uw_ct_service.info.yml                        |   1 +
 4 files changed, 133 insertions(+), 92 deletions(-)

diff --git a/config/install/core.entity_form_display.node.uw_ct_service.default.yml b/config/install/core.entity_form_display.node.uw_ct_service.default.yml
index 39d5892..8fb83cf 100644
--- a/config/install/core.entity_form_display.node.uw_ct_service.default.yml
+++ b/config/install/core.entity_form_display.node.uw_ct_service.default.yml
@@ -27,12 +27,13 @@ dependencies:
     - node.type.uw_ct_service
   module:
     - address
+    - content_moderation
     - field_group
     - geofield_map
     - link
     - media_library
     - metatag
-    - office_hours
+    - office_hours_exceptions
     - path
     - term_reference_tree
     - text
@@ -48,79 +49,79 @@ third_party_settings:
         - field_uw_service_length
         - field_uw_service_cost
         - field_uw_service_support
+      label: 'Service details'
+      region: content
       parent_name: ''
       weight: 4
       format_type: fieldset
-      region: content
       format_settings:
+        classes: ''
         show_empty_fields: false
         id: ''
-        classes: ''
         description: ''
         required_fields: true
-      label: 'Service details'
     group_service_location:
       children:
         - field_uw_service_location
         - field_uw_service_location_coord
         - field_uw_service_map
+      label: 'Service location'
+      region: content
       parent_name: ''
       weight: 8
       format_type: fieldset
-      region: content
       format_settings:
+        classes: ''
         show_empty_fields: false
         id: ''
-        classes: ''
         description: ''
         required_fields: true
-      label: 'Service location'
     group_hidden_fields_for_internal:
       children:
         - field_uw_service_owner
         - field_uw_service_contacts
+      label: 'Hidden fields for internal use only'
+      region: content
       parent_name: ''
       weight: 9
       format_type: fieldset
-      region: content
       format_settings:
+        classes: ''
         show_empty_fields: false
         id: ''
-        classes: ''
         description: ''
         required_fields: true
-      label: 'Hidden fields for internal use only'
     group_uw_service_metatag:
       children:
         - field_uw_meta_description
         - field_uw_meta_image
         - field_uw_meta_tags
+      label: 'Meta tag information for social media sharing/search/etc.'
+      region: content
       parent_name: ''
       weight: 10
       format_type: fieldset
-      region: content
       format_settings:
+        classes: ''
         show_empty_fields: false
         id: ''
-        classes: ''
         description: ''
         required_fields: true
-      label: 'Meta tag information for social media sharing/search/etc.'
     group_service_hours:
       children:
         - field_uw_service_hours
         - field_uw_service_hours_notes
+      label: 'Service hours'
+      region: content
       parent_name: ''
       weight: 5
       format_type: fieldset
-      region: content
       format_settings:
+        classes: ''
         show_empty_fields: false
         id: ''
-        classes: ''
         description: ''
         required_fields: true
-      label: 'Service hours'
 id: node.uw_ct_service.default
 targetEntityType: node
 bundle: uw_ct_service
@@ -133,7 +134,9 @@ content:
     settings: {  }
     third_party_settings: {  }
   field_uw_meta_description:
+    type: string_textarea
     weight: 36
+    region: content
     settings:
       rows: 3
       placeholder: ''
@@ -143,126 +146,127 @@ content:
         maxlength_js_label: 'Content limited to @limit characters, remaining: <strong>@remaining</strong>'
         maxlength_js_enforce: false
         maxlength_js_truncate_html: false
-    type: string_textarea
-    region: content
   field_uw_meta_image:
+    type: media_library_widget
     weight: 37
+    region: content
     settings:
       media_types: {  }
     third_party_settings: {  }
-    type: media_library_widget
-    region: content
   field_uw_meta_tags:
+    type: metatag_firehose
     weight: 38
+    region: content
     settings:
       sidebar: false
     third_party_settings: {  }
-    type: metatag_firehose
-    region: content
   field_uw_service_audience:
+    type: term_reference_tree
     weight: 27
+    region: content
     settings:
+      start_minimized: false
       leaves_only: true
       select_parents: true
       cascading_selection: 0
       max_depth: 0
-      start_minimized: false
     third_party_settings: {  }
-    type: term_reference_tree
-    region: content
   field_uw_service_available:
+    type: string_textfield
     weight: 28
+    region: content
     settings:
       size: 60
       placeholder: ''
     third_party_settings: {  }
-    type: string_textfield
-    region: content
   field_uw_service_category:
+    type: term_reference_tree
     weight: 3
+    region: content
     settings:
+      start_minimized: false
       leaves_only: true
       select_parents: true
       cascading_selection: 0
       max_depth: 0
-      start_minimized: false
     third_party_settings: {  }
-    type: term_reference_tree
-    region: content
   field_uw_service_contacts:
+    type: link_default
     weight: 35
+    region: content
     settings:
       placeholder_url: ''
       placeholder_title: ''
     third_party_settings: {  }
-    type: link_default
-    region: content
   field_uw_service_cost:
+    type: text_textarea
     weight: 32
+    region: content
     settings:
       rows: 5
       placeholder: ''
     third_party_settings: {  }
-    type: text_textarea
-    region: content
   field_uw_service_hours:
+    type: office_hours_exception
     weight: 6
+    region: content
     settings: {  }
     third_party_settings: {  }
-    type: office_hours_default
-    region: content
   field_uw_service_hours_notes:
+    type: string_textfield
     weight: 7
+    region: content
     settings:
       size: 60
       placeholder: ''
     third_party_settings: {  }
-    type: string_textfield
-    region: content
   field_uw_service_length:
+    type: string_textfield
     weight: 31
+    region: content
     settings:
       size: 60
       placeholder: ''
     third_party_settings: {  }
-    type: string_textfield
-    region: content
   field_uw_service_location:
+    type: address_default
     weight: 16
+    region: content
     settings: {  }
     third_party_settings: {  }
-    type: address_default
-    region: content
   field_uw_service_location_coord:
+    type: geofield_map
     weight: 17
+    region: content
     settings:
+      html5_geolocation: false
+      default_value:
+        lat: !!float 0
+        lon: !!float 0
+      map_library: leaflet
+      map_google_api_key: ''
       map_google_places:
-        places_additional_options: ''
         places_control: false
-      map_library: leaflet
-      map_type_google: roadmap
-      map_type_leaflet: OpenStreetMap_Mapnik
+        places_additional_options: ''
       map_dimensions:
         width: 100%
         height: 450px
+      map_type_google: roadmap
+      map_type_leaflet: OpenStreetMap_Mapnik
+      map_type_selector: false
+      zoom_level: 5
       zoom:
         start: 14
         focus: 14
         min: 0
         max: 22
-      geoaddress_field:
-        field: '0'
-        disabled: true
-        hidden: false
-      default_value:
-        lat: !!float 0
-        lon: !!float 0
-      map_type_selector: false
       click_to_find_marker: false
       click_to_place_marker: false
       hide_coordinates: false
-      html5_geolocation: false
-      map_google_api_key: ''
+      geoaddress_field:
+        field: '0'
+        hidden: false
+        disabled: true
       map_geocoder:
         control: 0
         settings:
@@ -270,12 +274,11 @@ content:
           min_terms: 4
           delay: 800
           options: ''
-      zoom_level: 5
     third_party_settings: {  }
-    type: geofield_map
-    region: content
   field_uw_service_map:
+    type: link_default
     weight: 19
+    region: content
     settings:
       placeholder_url: ''
       placeholder_title: ''
@@ -283,61 +286,59 @@ content:
       maxlength:
         maxlength_js: null
         maxlength_js_label: 'Content limited to @limit characters, remaining: <strong>@remaining</strong>'
-    type: link_default
-    region: content
   field_uw_service_notice:
+    type: string_textfield
     weight: 30
+    region: content
     settings:
       size: 60
       placeholder: ''
     third_party_settings: {  }
-    type: string_textfield
-    region: content
   field_uw_service_owner:
+    type: link_default
     weight: 34
+    region: content
     settings:
       placeholder_url: ''
       placeholder_title: ''
     third_party_settings: {  }
-    type: link_default
-    region: content
   field_uw_service_popularity:
+    type: number
     weight: 26
+    region: content
     settings:
       placeholder: ''
     third_party_settings: {  }
-    type: number
-    region: content
   field_uw_service_request:
+    type: text_textarea
     weight: 29
+    region: content
     settings:
       rows: 5
       placeholder: ''
     third_party_settings: {  }
-    type: text_textarea
-    region: content
   field_uw_service_status:
+    type: options_select
     weight: 2
+    region: content
     settings: {  }
     third_party_settings: {  }
-    type: options_select
-    region: content
   field_uw_service_summary:
+    type: text_textarea
     weight: 1
+    region: content
     settings:
       rows: 5
       placeholder: ''
     third_party_settings: {  }
-    type: text_textarea
-    region: content
   field_uw_service_support:
+    type: text_textarea
     weight: 33
+    region: content
     settings:
       rows: 5
       placeholder: ''
     third_party_settings: {  }
-    type: text_textarea
-    region: content
   langcode:
     type: language_select
     weight: 11
@@ -348,8 +349,8 @@ content:
   moderation_state:
     type: moderation_state_default
     weight: 18
-    settings: {  }
     region: content
+    settings: {  }
     third_party_settings: {  }
   path:
     type: path
@@ -359,24 +360,24 @@ content:
     third_party_settings: {  }
   promote:
     type: boolean_checkbox
-    settings:
-      display_label: true
     weight: 14
     region: content
+    settings:
+      display_label: true
     third_party_settings: {  }
   status:
     type: boolean_checkbox
-    settings:
-      display_label: true
     weight: 19
     region: content
+    settings:
+      display_label: true
     third_party_settings: {  }
   sticky:
     type: boolean_checkbox
-    settings:
-      display_label: true
     weight: 15
     region: content
+    settings:
+      display_label: true
     third_party_settings: {  }
   title:
     type: string_textfield
@@ -389,12 +390,12 @@ content:
   uid:
     type: entity_reference_autocomplete
     weight: 12
+    region: content
     settings:
       match_operator: CONTAINS
+      match_limit: 10
       size: 60
       placeholder: ''
-      match_limit: 10
-    region: content
     third_party_settings: {  }
   url_redirects:
     weight: 17
diff --git a/config/install/core.entity_view_display.node.uw_ct_service.teaser.yml b/config/install/core.entity_view_display.node.uw_ct_service.teaser.yml
index d1df3f4..ae79e26 100644
--- a/config/install/core.entity_view_display.node.uw_ct_service.teaser.yml
+++ b/config/install/core.entity_view_display.node.uw_ct_service.teaser.yml
@@ -27,6 +27,8 @@ dependencies:
     - field.field.node.uw_ct_service.layout_builder__layout
     - node.type.uw_ct_service
   module:
+    - fences
+    - office_hours_exceptions
     - user
 id: node.uw_ct_service.teaser
 targetEntityType: node
@@ -34,14 +36,52 @@ bundle: uw_ct_service
 mode: teaser
 content:
   content_moderation_control:
-    weight: -20
     settings: {  }
     third_party_settings: {  }
+    weight: 0
+    region: content
+  field_uw_service_hours:
+    type: office_hours_exceptions_default
+    label: hidden
+    settings:
+      show_closed: all
+      office_hours_first_day: ''
+      day_format: long
+      time_format: g
+      closed_format: Closed
+      separator:
+        days: '<br />'
+        grouped_days: ' - '
+        day_hours: ': '
+        hours_hours: '-'
+        more_hours: ', '
+      current_status:
+        position: ''
+        open_text: 'Currently open!'
+        closed_text: 'Currently closed'
+      exceptions:
+        restrict_exceptions_to_num_days: '7'
+        date_format: all_day_format
+        title: 'Closed/changed hours'
+      compress: 0
+      grouped: 0
+      schema:
+        enabled: 0
+      timezone_field: ''
+    third_party_settings:
+      fences:
+        fences_field_tag: div
+        fences_field_classes: ''
+        fences_field_item_tag: div
+        fences_field_item_classes: ''
+        fences_label_tag: div
+        fences_label_classes: ''
+    weight: 2
     region: content
   links:
-    weight: 100
     settings: {  }
     third_party_settings: {  }
+    weight: 1
     region: content
 hidden:
   field_uw_meta_description: true
@@ -52,7 +92,6 @@ hidden:
   field_uw_service_category: true
   field_uw_service_contacts: true
   field_uw_service_cost: true
-  field_uw_service_hours: true
   field_uw_service_hours_notes: true
   field_uw_service_length: true
   field_uw_service_location: true
diff --git a/config/install/field.storage.node.field_uw_service_hours.yml b/config/install/field.storage.node.field_uw_service_hours.yml
index 0e69fb3..107a1f2 100644
--- a/config/install/field.storage.node.field_uw_service_hours.yml
+++ b/config/install/field.storage.node.field_uw_service_hours.yml
@@ -9,16 +9,16 @@ field_name: field_uw_service_hours
 entity_type: node
 type: office_hours
 settings:
-  cardinality_per_day: 2
   time_format: g
-  element_type: office_hours_datelist
+  element_type: office_hours_datetime
   increment: 1
-  comment: 0
-  valhrs: true
   required_start: false
-  required_end: false
   limit_start: ''
+  required_end: false
   limit_end: ''
+  comment: 0
+  valhrs: true
+  cardinality_per_day: 2
 module: office_hours
 locked: false
 cardinality: -1
diff --git a/uw_ct_service.info.yml b/uw_ct_service.info.yml
index 9f625fb..c733f06 100644
--- a/uw_ct_service.info.yml
+++ b/uw_ct_service.info.yml
@@ -32,6 +32,7 @@ dependencies:
   - 'metatag:metatag'
   - 'node_revision_delete:node_revision_delete'
   - 'office_hours:office_hours'
+  - 'office_hours_exceptions:office_hours_exceptions'
   - 'simple_sitemap:simple_sitemap'
   - 'require_on_publish:require_on_publish'
   - 'term_reference_tree:term_reference_tree'
-- 
GitLab