From b3770f0d77b5081946fec11d050bd2ad1f5b43f1 Mon Sep 17 00:00:00 2001 From: Alexandre Dias Date: Tue, 28 Sep 2021 10:35:41 +0100 Subject: [PATCH] ISAICP-6584: Integrate Facets Form & Date Range Widget. --- composer.json | 4 + composer.lock | 63 +- .../sync/block.block.entity_bundle_facet.yml | 29 - ...k.block.facetformviewsearchdisplaypage.yml | 37 ++ config/sync/block.block.group_facet.yml | 29 - .../block.block.spatial_coverage_facet.yml | 29 - config/sync/block.block.three_dots_menu.yml | 2 + config/sync/block.block.topic_facet.yml | 29 - config/sync/core.extension.yml | 2 + config/sync/facets.facet.creation_date.yml | 63 ++ config/sync/facets.facet.group.yml | 11 +- config/sync/facets.facet.spatial_coverage.yml | 23 +- config/sync/facets.facet.topic.yml | 31 +- config/sync/facets.facet.type.yml | 29 +- ...y.facets_summary.search_facets_summary.yml | 6 - config/sync/filter.format.essential_html.yml | 122 +--- .../joinup_search/group_search.feature | 17 +- tests/features/joinup_search/search.feature | 179 +++--- .../joinup_search/search.feature.orig | 543 ------------------ tests/features/solution/homepage.feature | 4 +- tests/src/Context/JoinupSearchContext.php | 154 ++++- tests/src/Traits/TraversingTrait.php | 19 +- .../search_api_arbitrary_facet.module | 8 +- .../facet_source/SearchApiFieldDeriver.php | 1 + 24 files changed, 530 insertions(+), 904 deletions(-) delete mode 100644 config/sync/block.block.entity_bundle_facet.yml create mode 100644 config/sync/block.block.facetformviewsearchdisplaypage.yml delete mode 100644 config/sync/block.block.group_facet.yml delete mode 100644 config/sync/block.block.spatial_coverage_facet.yml delete mode 100644 config/sync/block.block.topic_facet.yml create mode 100644 config/sync/facets.facet.creation_date.yml delete mode 100644 tests/features/joinup_search/search.feature.orig diff --git a/composer.json b/composer.json index ecfe9475a1..21c6121bf8 100644 --- a/composer.json +++ b/composer.json @@ -32,6 +32,7 @@ "drupal/entity_legal": "^3.0.0-beta2", "drupal/error_page": "^1.0", "drupal/facets": "1.6.0", + "drupal/facets_form": "1.x-dev@dev", "drupal/field_delimiter": "^1.1", "drupal/field_group": "^3.1", "drupal/field_permissions": "^1.1", @@ -283,6 +284,9 @@ "Facet Summary for Facet Items with a set dependency. @see https://www.drupal.org/node/2873480": "resources/patch/facet_summary_for_facet-2873480-18.patch", "SA-CONTRIB-2021-008. @see https://www.drupal.org/sa-contrib-2021-008": "https://www.drupal.org/files/issues/2021-05-17/3213582-facets-1.6-1.7.patch" }, + "drupal/facets_form": { + "Implement calculate dependencies. @see https://www.drupal.org/project/facets_form/issues/3230468": "https://git.drupalcode.org/project/facets_form/-/merge_requests/15.diff" + }, "drupal/honeypot": { "Behat integration. @see https://www.drupal.org/project/honeypot/issues/3059040": "https://www.drupal.org/files/issues/2020-09-09/3059040-31.patch", "Provide ways to clean up old honeypot_time_restriction values @see https://www.drupal.org/project/honeypot/issues/2997609": "https://git.drupalcode.org/project/honeypot/-/merge_requests/2.diff" diff --git a/composer.lock b/composer.lock index afe9640863..9cbddd041e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "38c68c57b179dcfdc69537687193698d", + "content-hash": "0adbae751418bdc73f6ddc0a2df028c2", "packages": [ { "name": "SEMICeu/adms-ap_validator", @@ -3832,7 +3832,8 @@ }, "patches_applied": { "Facet Summary for Facet Items with a set dependency. @see https://www.drupal.org/node/2873480": "resources/patch/facet_summary_for_facet-2873480-18.patch", - "SA-CONTRIB-2021-008. @see https://www.drupal.org/sa-contrib-2021-008": "https://www.drupal.org/files/issues/2021-05-17/3213582-facets-1.6-1.7.patch" + "SA-CONTRIB-2021-008. @see https://www.drupal.org/sa-contrib-2021-008": "https://www.drupal.org/files/issues/2021-05-17/3213582-facets-1.6-1.7.patch", + "https://www.drupal.org/project/facets/issues/3223956": "https://git.drupalcode.org/project/facets/-/merge_requests/25.diff" } }, "notification-url": "https://packages.drupal.org/8/downloads", @@ -3869,6 +3870,63 @@ "irc": "irc://irc.freenode.org/drupal-search-api" } }, + { + "name": "drupal/facets_form", + "version": "dev-1.x", + "source": { + "type": "git", + "url": "https://git.drupalcode.org/project/facets_form.git", + "reference": "85965678f7d051c929be267cd1fd15453d556559" + }, + "require": { + "cweagans/composer-patches": "^1.7", + "drupal/core": "^8.9 || ^9.1", + "drupal/facets": "^1.6" + }, + "require-dev": { + "drupal/search_api": "^1.13" + }, + "type": "drupal-module", + "extra": { + "branch-alias": { + "dev-1.x": "1.x-dev" + }, + "drupal": { + "version": "1.x-dev", + "datestamp": "1629847996", + "security-coverage": { + "status": "not-covered", + "message": "Dev releases are not covered by Drupal security advisories." + } + }, + "enable-patching": true, + "patches": { + "drupal/facets": { + "https://www.drupal.org/project/facets/issues/3223956": "https://git.drupalcode.org/project/facets/-/merge_requests/25.diff" + } + } + }, + "notification-url": "https://packages.drupal.org/8/downloads", + "license": [ + "GPL-2.0+" + ], + "authors": [ + { + "name": "Claudiu Cristea", + "homepage": "https://www.drupal.org/u/claudiucristea" + }, + { + "name": "Andras Szilagyi", + "homepage": "https://www.drupal.org/u/andras_szilagyi" + } + ], + "description": "Place the facets of a given facets source in a form", + "homepage": "https://www.drupal.org/project/facets_form", + "support": { + "source": "https://git.drupalcode.org/project/facets_form", + "issues": "https://www.drupal.org/project/issues/facets_form" + } + }, { "name": "drupal/field_delimiter", "version": "1.1.0", @@ -19583,6 +19641,7 @@ "dkarv/mdl-chip-input": 20, "drupal/cas_attributes": 20, "drupal/config_ignore": 20, + "drupal/facets_form": 20, "drupal/menu_link_destination": 20, "drupal/og": 20, "drupal/site_verify": 20, diff --git a/config/sync/block.block.entity_bundle_facet.yml b/config/sync/block.block.entity_bundle_facet.yml deleted file mode 100644 index e143fead9f..0000000000 --- a/config/sync/block.block.entity_bundle_facet.yml +++ /dev/null @@ -1,29 +0,0 @@ -uuid: 5d10248b-fb61-4515-b58a-97d58639df37 -langcode: en -status: true -dependencies: - config: - - facets.facet.type - module: - - facets - - joinup_core - theme: - - joinup_theme -id: entity_bundle_facet -theme: joinup_theme -region: sidebar_left -weight: -18 -provider: null -plugin: 'facet_block:type' -settings: - id: 'facet_block:type' - label: 'Content types' - provider: facets - label_display: '1' -visibility: - request_route: - id: request_route - routes: - - view.search.page_1 - negate: false - context_mapping: { } diff --git a/config/sync/block.block.facetformviewsearchdisplaypage.yml b/config/sync/block.block.facetformviewsearchdisplaypage.yml new file mode 100644 index 0000000000..c09b923e35 --- /dev/null +++ b/config/sync/block.block.facetformviewsearchdisplaypage.yml @@ -0,0 +1,37 @@ +uuid: 33e5f26c-41da-4f9b-85a8-144a7b0bfe07 +langcode: en +status: true +dependencies: + config: + - facets.facet.creation_date + - facets.facet.group + - facets.facet.spatial_coverage + - facets.facet.topic + - facets.facet.type + module: + - facets_form + - system + theme: + - joinup_theme +id: facetformviewsearchdisplaypage +theme: joinup_theme +region: sidebar_left +weight: 0 +provider: null +plugin: 'facets_form:search_api:views_page__search__page_1' +settings: + id: 'facets_form:search_api:views_page__search__page_1' + label: 'Facet form: View Search, display Page' + provider: facets_form + label_display: '0' + button: + label: + submit: Search + reset: 'Clear filters' + facets: { } +visibility: + request_path: + id: request_path + pages: "/search\r\n/search/*" + negate: false + context_mapping: { } diff --git a/config/sync/block.block.group_facet.yml b/config/sync/block.block.group_facet.yml deleted file mode 100644 index d383dd0cc3..0000000000 --- a/config/sync/block.block.group_facet.yml +++ /dev/null @@ -1,29 +0,0 @@ -uuid: cf94fd0f-8d17-4fbf-9f2f-388da1a3db5b -langcode: en -status: true -dependencies: - config: - - facets.facet.group - module: - - facets - - joinup_core - theme: - - joinup_theme -id: group_facet -theme: joinup_theme -region: sidebar_left -weight: -17 -provider: null -plugin: 'facet_block:group' -settings: - id: 'facet_block:group' - label: 'Search page - Group facet' - provider: facets - label_display: '0' -visibility: - request_route: - id: request_route - routes: - - view.search.page_1 - negate: false - context_mapping: { } diff --git a/config/sync/block.block.spatial_coverage_facet.yml b/config/sync/block.block.spatial_coverage_facet.yml deleted file mode 100644 index 9c056bba23..0000000000 --- a/config/sync/block.block.spatial_coverage_facet.yml +++ /dev/null @@ -1,29 +0,0 @@ -uuid: 1da70601-9a66-4756-9564-d4b2f3e5e81d -langcode: en -status: true -dependencies: - config: - - facets.facet.spatial_coverage - module: - - facets - - joinup_core - theme: - - joinup_theme -id: spatial_coverage_facet -theme: joinup_theme -region: sidebar_left -weight: -15 -provider: null -plugin: 'facet_block:spatial_coverage' -settings: - id: 'facet_block:spatial_coverage' - label: 'Search page - Geographical coverage facet' - provider: facets - label_display: '0' -visibility: - request_route: - id: request_route - routes: - - view.search.page_1 - negate: false - context_mapping: { } diff --git a/config/sync/block.block.three_dots_menu.yml b/config/sync/block.block.three_dots_menu.yml index 0392828e5f..07ccb91c0d 100644 --- a/config/sync/block.block.three_dots_menu.yml +++ b/config/sync/block.block.three_dots_menu.yml @@ -2,6 +2,8 @@ uuid: 998c6074-0e67-43ac-b241-615239dee76a langcode: en status: true dependencies: + module: + - joinup_core theme: - joinup_theme id: three_dots_menu diff --git a/config/sync/block.block.topic_facet.yml b/config/sync/block.block.topic_facet.yml deleted file mode 100644 index 8d28878d23..0000000000 --- a/config/sync/block.block.topic_facet.yml +++ /dev/null @@ -1,29 +0,0 @@ -uuid: 976857e9-05a8-4454-8ec8-8974fd527045 -langcode: en -status: true -dependencies: - config: - - facets.facet.topic - module: - - facets - - joinup_core - theme: - - joinup_theme -id: topic_facet -theme: joinup_theme -region: sidebar_left -weight: -16 -provider: null -plugin: 'facet_block:topic' -settings: - id: 'facet_block:topic' - label: 'Search page - Topic facet' - provider: facets - label_display: '0' -visibility: - request_route: - id: request_route - routes: - - view.search.page_1 - negate: false - context_mapping: { } diff --git a/config/sync/core.extension.yml b/config/sync/core.extension.yml index 516e8743d3..ffacc0fef9 100644 --- a/config/sync/core.extension.yml +++ b/config/sync/core.extension.yml @@ -43,6 +43,8 @@ module: eu_sic: 0 eupl: 0 facets: 0 + facets_form: 0 + facets_form_date_range: 0 facets_summary: 0 field: 0 field_delimiter: 0 diff --git a/config/sync/facets.facet.creation_date.yml b/config/sync/facets.facet.creation_date.yml new file mode 100644 index 0000000000..18d2af5bea --- /dev/null +++ b/config/sync/facets.facet.creation_date.yml @@ -0,0 +1,63 @@ +uuid: d23291d8-c77d-4c38-a3ae-d6c6d900d0c3 +langcode: en +status: true +dependencies: + config: + - search_api.index.published + - views.view.search + module: + - search_api +id: creation_date +name: 'Creation Date' +url_alias: creation_date +weight: 0 +min_count: 1 +show_only_one_result: true +field_identifier: rdf_created +facet_source_id: 'search_api:views_page__search__page_1' +widget: + type: facets_form_date_range + config: + date_type: date + label: + from: 'Date from' + to: 'Date to' + date_format: + type: date_only + custom: '' + show_numbers: false +query_operator: or +use_hierarchy: false +expand_hierarchy: false +enable_parent_when_child_gets_disabled: true +hard_limit: 0 +exclude: false +only_visible_when_facet_source_is_visible: true +processor_configs: + active_widget_order: + processor_id: active_widget_order + weights: + sort: -10 + settings: + sort: DESC + count_widget_order: + processor_id: count_widget_order + weights: + sort: -10 + settings: + sort: DESC + display_value_widget_order: + processor_id: display_value_widget_order + weights: + sort: -10 + settings: + sort: ASC + url_processor_handler: + processor_id: url_processor_handler + weights: + pre_query: 50 + build: -10 + settings: { } +empty_behavior: + behavior: none +show_title: true diff --git a/config/sync/facets.facet.group.yml b/config/sync/facets.facet.group.yml index 92794194b4..5ddc191e5e 100644 --- a/config/sync/facets.facet.group.yml +++ b/config/sync/facets.facet.group.yml @@ -16,11 +16,12 @@ show_only_one_result: true field_identifier: entity_groups facet_source_id: 'search_api:views_page__search__page_1' widget: - type: dropdown + type: facets_form_dropdown config: - show_numbers: true default_option_label: 'Any Collection or Solution' - arbitrary_facet_plugin: _none + child_items_prefix: '-' + disabled_on_empty: false + show_numbers: true query_operator: or use_hierarchy: false expand_hierarchy: false @@ -34,7 +35,7 @@ processor_configs: weights: sort: -2 settings: - sort: DESC + sort: ASC aggregated_entity_reference_label: processor_id: aggregated_entity_reference_label weights: @@ -52,7 +53,7 @@ processor_configs: weights: sort: -1 settings: - sort: DESC + sort: ASC display_value_widget_order: processor_id: display_value_widget_order weights: diff --git a/config/sync/facets.facet.spatial_coverage.yml b/config/sync/facets.facet.spatial_coverage.yml index 054557114b..7f1e943a2d 100644 --- a/config/sync/facets.facet.spatial_coverage.yml +++ b/config/sync/facets.facet.spatial_coverage.yml @@ -10,17 +10,18 @@ dependencies: id: spatial_coverage name: 'Geographic coverage' url_alias: spatial_coverage -weight: 0 +weight: -1 min_count: 1 show_only_one_result: true field_identifier: spatial_coverage facet_source_id: 'search_api:views_page__search__page_1' widget: - type: dropdown + type: facets_form_dropdown config: - show_numbers: true default_option_label: 'Any location' - arbitrary_facet_plugin: _none + child_items_prefix: '-' + disabled_on_empty: false + show_numbers: true query_operator: or use_hierarchy: false expand_hierarchy: false @@ -34,36 +35,36 @@ processor_configs: weights: sort: -8 settings: - sort: DESC + sort: ASC aggregated_entity_reference_label: processor_id: aggregated_entity_reference_label weights: - build: 0 + build: -10 settings: { } count_limit: processor_id: count_limit weights: - build: -2 + build: 5 settings: minimum_items: 1 maximum_items: null count_widget_order: processor_id: count_widget_order weights: - sort: -9 + sort: -10 settings: - sort: DESC + sort: ASC display_value_widget_order: processor_id: display_value_widget_order weights: - sort: -10 + sort: -8 settings: sort: ASC url_processor_handler: processor_id: url_processor_handler weights: pre_query: -10 - build: -1 + build: 5 settings: { } empty_behavior: behavior: none diff --git a/config/sync/facets.facet.topic.yml b/config/sync/facets.facet.topic.yml index d725759bb2..92400d080b 100644 --- a/config/sync/facets.facet.topic.yml +++ b/config/sync/facets.facet.topic.yml @@ -8,22 +8,23 @@ dependencies: module: - search_api id: topic -name: Topic +name: Topics url_alias: topic -weight: 0 +weight: -3 min_count: 1 show_only_one_result: true field_identifier: topic facet_source_id: 'search_api:views_page__search__page_1' widget: - type: dropdown + type: facets_form_dropdown config: - show_numbers: true default_option_label: 'Any topic' - arbitrary_facet_plugin: _none + child_items_prefix: '-' + disabled_on_empty: false + show_numbers: false query_operator: or -use_hierarchy: false -expand_hierarchy: false +use_hierarchy: true +expand_hierarchy: true enable_parent_when_child_gets_disabled: false hard_limit: 0 exclude: false @@ -32,38 +33,38 @@ processor_configs: active_widget_order: processor_id: active_widget_order weights: - sort: -2 + sort: -8 settings: - sort: DESC + sort: ASC aggregated_entity_reference_label: processor_id: aggregated_entity_reference_label weights: - build: -1 + build: 5 settings: { } count_limit: processor_id: count_limit weights: - build: 0 + build: -10 settings: minimum_items: 1 maximum_items: null count_widget_order: processor_id: count_widget_order weights: - sort: -1 + sort: -10 settings: - sort: DESC + sort: ASC display_value_widget_order: processor_id: display_value_widget_order weights: - sort: 0 + sort: -8 settings: sort: ASC url_processor_handler: processor_id: url_processor_handler weights: pre_query: -10 - build: -2 + build: 5 settings: { } empty_behavior: behavior: none diff --git a/config/sync/facets.facet.type.yml b/config/sync/facets.facet.type.yml index b3f228235f..763987f5d6 100644 --- a/config/sync/facets.facet.type.yml +++ b/config/sync/facets.facet.type.yml @@ -8,25 +8,20 @@ dependencies: module: - search_api id: type -name: Type +name: 'Content types' url_alias: type -weight: 0 +weight: -2 min_count: 1 show_only_one_result: false field_identifier: entity_bundle facet_source_id: 'search_api:views_page__search__page_1' widget: - type: checkbox + type: facets_form_dropdown config: + default_option_label: Choose + child_items_prefix: '-' + disabled_on_empty: false show_numbers: true - soft_limit: 0 - soft_limit_settings: - show_less_label: 'Show less' - show_more_label: 'Show more' - show_reset_link: false - reset_text: 'Show all' - hide_reset_when_no_selection: false - arbitrary_facet_plugin: _none query_operator: or use_hierarchy: false expand_hierarchy: false @@ -38,7 +33,7 @@ processor_configs: aggregated_entity_bundle_label: processor_id: aggregated_entity_bundle_label weights: - build: -10 + build: 5 settings: plural_count_label: enabled: true @@ -46,10 +41,16 @@ processor_configs: count_limit: processor_id: count_limit weights: - build: 0 + build: -10 settings: minimum_items: 1 maximum_items: null + display_value_widget_order: + processor_id: display_value_widget_order + weights: + sort: 40 + settings: + sort: ASC joinup_search_content_type_fixed_order: processor_id: joinup_search_content_type_fixed_order weights: @@ -64,4 +65,4 @@ processor_configs: settings: { } empty_behavior: behavior: none -show_title: false +show_title: true diff --git a/config/sync/facets_summary.facets_summary.search_facets_summary.yml b/config/sync/facets_summary.facets_summary.search_facets_summary.yml index e06737b2db..0675885066 100644 --- a/config/sync/facets_summary.facets_summary.search_facets_summary.yml +++ b/config/sync/facets_summary.facets_summary.search_facets_summary.yml @@ -10,12 +10,6 @@ dependencies: id: search_facets_summary name: 'Search facets summary' facets: - group: - checked: true - label: Collection/Solution - separator: ', ' - weight: 0 - show_count: false spatial_coverage: checked: true label: 'Geographic coverage' diff --git a/config/sync/filter.format.essential_html.yml b/config/sync/filter.format.essential_html.yml index 9bd332877e..efb030f24e 100644 --- a/config/sync/filter.format.essential_html.yml +++ b/config/sync/filter.format.essential_html.yml @@ -1,140 +1,58 @@ -uuid: 66d0b8e4-98a3-45d1-8091-b96a313046cb +uuid: 5e41fc3f-ac9f-4211-89b9-b4052f4eda6e langcode: en status: true dependencies: - config: - - image.style.wysiwyg_full_width - - image.style.wysiwyg_half_width - - image.style.wysiwyg_one_third_width module: - - collection - - editor - - embed_block - - image - joinup_video - - linkit - media - - video_embed_wysiwyg -name: 'Simple HTML' -format: simple_html -weight: 3 +_core: + default_config_hash: _EOmoFGHhTjV4rORLrzpQZv9C6rnPb8LVLDoNMqBz7Us +name: 'Essential HTML' +format: essential_html +weight: 0 filters: filter_url: id: filter_url provider: filter status: true - weight: -50 + weight: -49 settings: filter_url_length: 72 filter_html: id: filter_html provider: filter status: true - weight: -49 + weight: -48 settings: - allowed_html: '