diff --git a/composer.json b/composer.json index 296329bb..89832fc2 100644 --- a/composer.json +++ b/composer.json @@ -124,6 +124,7 @@ "localgovdrupal/localgov": "^3", "localgovdrupal/localgov_base": "^1.5", "localgovdrupal/localgov_content_access_control": "^1.0", + "localgovdrupal/localgov_directories": "^3.2", "localgovdrupal/localgov_eu_cookie_compliance": "^1.0", "localgovdrupal/localgov_forms": "^1.0@beta", "localgovdrupal/localgov_geo": "^2", @@ -208,7 +209,8 @@ "Error when accessing a preview link if enabled_entity_types configuration is missing": "https://www.drupal.org/files/issues/2024-04-04/preview_link-3438117-enabled_entity_types.patch" }, "localgovdrupal/localgov_directories": { - "Support facets form": "https://patch-diff.githubusercontent.com/raw/localgovdrupal/localgov_directories/pull/399.diff" + "Support facets form": "https://patch-diff.githubusercontent.com/raw/localgovdrupal/localgov_directories/pull/399.diff", + "Set order of facets on channel": "patches/localgov_directories_facets.patch" }, "localgovdrupal/localgov_publications": { "Declare permissions for LocalGov Publications": "patches/localgov_publications.patch" diff --git a/composer.lock b/composer.lock index bfccebb5..f8821f0a 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": "4df4ec4d7612fd245ad3b4d27bcfdcc0", + "content-hash": "bd254ffe2098e09d8f31a3703d8fda13", "packages": [ { "name": "asm89/stack-cors", diff --git a/config/default/block.block.ecc_theme_gov_facets.yml b/config/default/block.block.ecc_theme_gov_facets.yml new file mode 100644 index 00000000..d7a7147d --- /dev/null +++ b/config/default/block.block.ecc_theme_gov_facets.yml @@ -0,0 +1,25 @@ +uuid: e9914b02-a477-4220-8050-fdb944b13c28 +langcode: en +status: true +dependencies: + config: + - facets.facet.localgov_directories_facets + module: + - block_classes + - facets + theme: + - ecc_theme_gov +id: ecc_theme_gov_facets +theme: ecc_theme_gov +region: sidebar_first +weight: 0 +provider: null +plugin: 'facet_block:localgov_directories_facets' +settings: + id: 'facet_block:localgov_directories_facets' + label: Facets + label_display: visible + provider: facets + context_mapping: { } + block_id: ecc_theme_gov_facets +visibility: { } diff --git a/config/default/core.entity_form_display.node.localgov_directory.default.yml b/config/default/core.entity_form_display.node.localgov_directory.default.yml index 406ffc4c..45fdf468 100644 --- a/config/default/core.entity_form_display.node.localgov_directory.default.yml +++ b/config/default/core.entity_form_display.node.localgov_directory.default.yml @@ -45,10 +45,14 @@ content: settings: { } third_party_settings: { } localgov_directory_facets_enable: - type: options_buttons + type: entity_reference_autocomplete weight: 13 region: content - settings: { } + settings: + match_operator: CONTAINS + match_limit: 10 + size: 60 + placeholder: '' third_party_settings: { } localgov_review_date: type: review_date @@ -56,6 +60,16 @@ content: region: content settings: { } third_party_settings: { } + localgov_service_contacts: + type: entity_reference_autocomplete + weight: 26 + region: content + settings: + match_operator: CONTAINS + match_limit: 10 + size: 60 + placeholder: '' + third_party_settings: { } localgov_services_parent: type: entity_reference_autocomplete weight: 9 diff --git a/config/envs/ddev/devel.settings.yml b/config/envs/ddev/devel.settings.yml deleted file mode 100644 index 976cc91f..00000000 --- a/config/envs/ddev/devel.settings.yml +++ /dev/null @@ -1,12 +0,0 @@ -_core: - default_config_hash: Aqx6J0yYT6mVqT0fbjeP4JkoL-700nmudVF5d6Pq2Yo -page_alter: false -raw_names: false -error_handlers: - 1: 1 -rebuild_theme: false -debug_mail_file_format: '%to-%subject-%datetime.mail.txt' -debug_mail_directory: 'temporary://devel-mails' -devel_dumper: var_dumper -debug_logfile: 'temporary://drupal_debug.txt' -debug_pre: true diff --git a/config/envs/ddev/devel.toolbar.settings.yml b/config/envs/ddev/devel.toolbar.settings.yml deleted file mode 100644 index 76ada43c..00000000 --- a/config/envs/ddev/devel.toolbar.settings.yml +++ /dev/null @@ -1,10 +0,0 @@ -_core: - default_config_hash: IQjf_ytthngZTAk_MU8-74VecArWD3G5g0oEH6PM6GA -toolbar_items: - - devel.admin_settings_link - - devel.cache_clear - - devel.container_info.service - - devel.menu_rebuild - - devel.reinstall - - devel.route_info - - devel.run_cron diff --git a/config/envs/ddev/system.menu.devel.yml b/config/envs/ddev/system.menu.devel.yml deleted file mode 100644 index 089c53bb..00000000 --- a/config/envs/ddev/system.menu.devel.yml +++ /dev/null @@ -1,13 +0,0 @@ -uuid: aae32930-de65-44f2-b518-7bfee7f5a996 -langcode: en -status: true -dependencies: - enforced: - module: - - devel -_core: - default_config_hash: 3V-l1uuTcyirYOGLPZV5HWaDfr02uEbWZJIwc8Byz-c -id: devel -label: Development -description: 'Links related to Devel module.' -locked: true diff --git a/patches/localgov_directories_facets.patch b/patches/localgov_directories_facets.patch new file mode 100644 index 00000000..0304a603 --- /dev/null +++ b/patches/localgov_directories_facets.patch @@ -0,0 +1,54 @@ +diff --git a/src/DirectoryExtraFieldDisplay.php b/src/DirectoryExtraFieldDisplay.php +index 3c36e36..ce1c066 100644 +--- a/src/DirectoryExtraFieldDisplay.php ++++ b/src/DirectoryExtraFieldDisplay.php +@@ -342,11 +342,12 @@ class DirectoryExtraFieldDisplay implements ContainerInjectionInterface, Trusted + $facet_storage = $this->entityTypeManager + ->getStorage(Directory::FACET_CONFIG_ENTITY_ID); + $group_items = []; ++ $all_group_items = []; + foreach ($facet_items as $key => $item) { + $facet_id = $item['value']['#attributes']['data-drupal-facet-item-value'] ?? $key; + if ($facet_entity = $facet_storage->load($facet_id)) { + assert($facet_entity instanceof LocalgovDirectoriesFacets); +- $group_items[$facet_entity->bundle()]['items'][$key] = $item; ++ $all_group_items[$facet_entity->bundle()]['items'][$key] = $item; + } + } + +@@ -359,19 +360,31 @@ class DirectoryExtraFieldDisplay implements ContainerInjectionInterface, Trusted + ) { + $active_facets = array_column($channel->localgov_directory_facets_enable->getValue(), 'target_id'); + } +- if (!is_null($active_facets)) { +- $group_items = array_intersect_key($group_items, array_flip($active_facets)); ++ $is_channel = !is_null($active_facets); ++ ++ if ($is_channel) { ++ // Use only the groups set on the channel, keeping the order. ++ foreach ($active_facets as $active_facet) { ++ $group_items[$active_facet] = $all_group_items[$active_facet]; ++ } ++ } ++ else { ++ // Use all groups if not on a channel. ++ $group_items = $all_group_items; + } + ++ $weight = 0; + $type_storage = $this->entityTypeManager + ->getStorage(Directory::FACET_TYPE_CONFIG_ENTITY_ID); + foreach ($group_items as $bundle => $items) { + $facet_type_entity = $type_storage->load($bundle); + assert($facet_type_entity instanceof LocalgovDirectoriesFacetsType); + $group_items[$bundle]['title'] = Html::escape($this->entityRepository->getTranslationFromContext($facet_type_entity)->label()); +- $group_items[$bundle]['weight'] = $facet_type_entity->get('weight'); ++ $group_items[$bundle]['weight'] = $is_channel ? $weight++ : $facet_type_entity->get('weight'); ++ } ++ if (!$is_channel) { ++ uasort($group_items, static::compareFacetBundlesByWeight(...)); + } +- uasort($group_items, static::compareFacetBundlesByWeight(...)); + + return $group_items; + }