diff --git a/services/drupal/config/sync/views.view.dynamic_event_list.yml b/services/drupal/config/sync/views.view.dynamic_event_list.yml index abaab9f82e..b48b03e177 100644 --- a/services/drupal/config/sync/views.view.dynamic_event_list.yml +++ b/services/drupal/config/sync/views.view.dynamic_event_list.yml @@ -133,9 +133,9 @@ display: plugin_id: date order: ASC expose: - label: '' + label: 'Date - Start' field_identifier: field_daterange_value - exposed: false + exposed: true granularity: second arguments: { } filters: @@ -815,6 +815,8 @@ display: - 'languages:language_content' - 'languages:language_interface' - url + - 'url.query_args:sort_by' + - 'url.query_args:sort_order' - user - 'user.node_grants:view' - user.permissions @@ -825,6 +827,50 @@ display: display_plugin: block position: 1 display_options: + sorts: + field_daterange_value: + id: field_daterange_value + table: node__field_daterange + field: field_daterange_value + relationship: none + group_type: group + admin_label: '' + plugin_id: date + order: ASC + expose: + label: 'Event Date' + field_identifier: field_daterange_value + exposed: true + granularity: second + field_last_published_value: + id: field_last_published_value + table: node__field_last_published + field: field_last_published_value + relationship: none + group_type: group + admin_label: '' + plugin_id: datetime + order: ASC + expose: + label: 'Publication Date' + field_identifier: field_last_published_value + exposed: true + granularity: second + title: + id: title + table: node_field_data + field: title + relationship: none + group_type: group + admin_label: '' + entity_type: node + entity_field: title + plugin_id: standard + order: ASC + expose: + label: Title + field_identifier: title + exposed: true style: type: epa_core_uswds_collection options: @@ -837,6 +883,7 @@ display: defaults: style: false row: false + sorts: false display_description: '' display_extenders: views_ajax_get: @@ -847,6 +894,8 @@ display: - 'languages:language_content' - 'languages:language_interface' - url + - 'url.query_args:sort_by' + - 'url.query_args:sort_order' - user - 'user.node_grants:view' - user.permissions diff --git a/services/drupal/config/sync/views.view.dynamic_faq_list.yml b/services/drupal/config/sync/views.view.dynamic_faq_list.yml index 67c3c534b3..571608b677 100644 --- a/services/drupal/config/sync/views.view.dynamic_faq_list.yml +++ b/services/drupal/config/sync/views.view.dynamic_faq_list.yml @@ -133,9 +133,9 @@ display: plugin_id: datetime order: DESC expose: - label: 'Last published' + label: 'Last published (field_last_published)' field_identifier: field_last_published_value - exposed: false + exposed: true granularity: second arguments: { } filters: @@ -714,6 +714,8 @@ display: - 'languages:language_content' - 'languages:language_interface' - url + - 'url.query_args:sort_by' + - 'url.query_args:sort_order' - user - 'user.node_grants:view' - user.permissions @@ -724,6 +726,36 @@ display: display_plugin: block position: 1 display_options: + sorts: + field_last_published_value: + id: field_last_published_value + table: node__field_last_published + field: field_last_published_value + relationship: none + group_type: group + admin_label: '' + plugin_id: datetime + order: DESC + expose: + label: 'Publication Date' + field_identifier: field_last_published_value + exposed: true + granularity: second + title: + id: title + table: node_field_data + field: title + relationship: none + group_type: group + admin_label: '' + entity_type: node + entity_field: title + plugin_id: standard + order: ASC + expose: + label: Title + field_identifier: title + exposed: true style: type: epa_core_uswds_collection options: @@ -736,6 +768,7 @@ display: defaults: style: false row: false + sorts: false display_description: '' display_extenders: views_ajax_get: @@ -746,6 +779,8 @@ display: - 'languages:language_content' - 'languages:language_interface' - url + - 'url.query_args:sort_by' + - 'url.query_args:sort_order' - user - 'user.node_grants:view' - user.permissions diff --git a/services/drupal/web/modules/custom/epa_viewsreference/epa_viewsreference.module b/services/drupal/web/modules/custom/epa_viewsreference/epa_viewsreference.module index 5bd7fa6f43..bbde60b1e1 100644 --- a/services/drupal/web/modules/custom/epa_viewsreference/epa_viewsreference.module +++ b/services/drupal/web/modules/custom/epa_viewsreference/epa_viewsreference.module @@ -34,12 +34,15 @@ function epa_viewsreference_field_widget_form_alter(array &$element, FormStateIn $element["options"]["exposed_filters"]["vr_exposed_filters_visible"]['#access'] = FALSE; } - // Make "DESC" be the default sort order for Perspectives. - if (isset($element["target_id"]["#default_value"]) && $element["target_id"]["#default_value"] === 'dynamic_list_perspectives' && isset($element['options']['exposed_sorts']['sort_order']['#options'])) { - $element['options']['exposed_sorts']['sort_order']['#options'] = [ - 'DESC' => t('Desc'), - 'ASC' => t('Asc'), - ]; + // Make "DESC" be the default sort order for Perspectives and FAQ List. + $view_types = ['dynamic_faq_list', 'dynamic_list_perspectives']; + if (in_array($element["target_id"]["#default_value"], $view_types)) { + $data = $context['items'][0]->getValue('data'); + $data_values = unserialize($data['data']); + $sort_order = $data_values['exposed_sorts']['sort_order']; + if (empty($sort_order)) { + $element["options"]["exposed_sorts"]["sort_order"]["#default_value"] = 'DESC'; + } } } }