From d5e45b29541717f91995fbb749d3eab5e1927cfe Mon Sep 17 00:00:00 2001 From: rajeshreeputra Date: Fri, 27 Dec 2024 17:27:52 +0530 Subject: [PATCH 01/18] ACMS-4246: Refactor Acquia Starter Kit Search to work with recipe. --- .../acquia_cms_search.info.yml | 1 - .../acquia_cms_search.install | 16 ++--- .../acquia_cms_search.module | 60 ++++++------------- modules/acquia_cms_search/composer.json | 2 - .../block.block.clear_facet_filters.yml | 16 ++--- .../block.block.exposed_form_search.yml | 13 ++-- .../optional/block.block.search_category.yml | 13 ++-- .../block.block.search_content_type.yml | 13 ++-- .../search_api.index.content.yml | 3 - .../search_api_autocomplete.search.search.yml | 0 .../optional/views.view.acquia_search.yml | 2 +- .../views.view.search.yml | 1 - .../views.view.search_fallback.yml | 0 .../schema/acquia_cms_search.schema.yml | 10 +++- .../src/Facade/SearchFacade.php | 9 +-- 15 files changed, 56 insertions(+), 103 deletions(-) rename modules/acquia_cms_search/config/{install => optional}/search_api.index.content.yml (97%) rename modules/acquia_cms_search/config/{install => optional}/search_api_autocomplete.search.search.yml (100%) rename modules/acquia_cms_search/config/{install => optional}/views.view.search.yml (99%) rename modules/acquia_cms_search/config/{install => optional}/views.view.search_fallback.yml (100%) diff --git a/modules/acquia_cms_search/acquia_cms_search.info.yml b/modules/acquia_cms_search/acquia_cms_search.info.yml index 74ddb9f01..236651b4f 100644 --- a/modules/acquia_cms_search/acquia_cms_search.info.yml +++ b/modules/acquia_cms_search/acquia_cms_search.info.yml @@ -4,7 +4,6 @@ description: "Provides powerful search capabilities to the site" type: module core_version_requirement: ^10.1 || ^11 dependencies: - - acquia_cms_common:acquia_cms_common - collapsiblock:collapsiblock - facets:facets - facets_pretty_paths:facets_pretty_paths diff --git a/modules/acquia_cms_search/acquia_cms_search.install b/modules/acquia_cms_search/acquia_cms_search.install index 355a01258..563fa3352 100644 --- a/modules/acquia_cms_search/acquia_cms_search.install +++ b/modules/acquia_cms_search/acquia_cms_search.install @@ -24,21 +24,15 @@ function acquia_cms_search_install($is_syncing) { // Retroactively enable indexing for any content types that existed before // this module was installed. - $node_types = NodeType::loadMultiple(); + $node_types = \Drupal::entityTypeManager()->getStorage('node_type')->loadMultiple(); array_walk($node_types, 'acquia_cms_search_node_type_insert'); - $enabled_modules = \Drupal::service('module_handler')->getModuleList(); - $enabled_modules = array_keys($enabled_modules); - _acquia_cms_search_add_category_facet($enabled_modules); + $search_category = \Drupal::entityTypeManager()->getStorage('facets_facet')->loadByProperties(['id' => 'search_category']); + if (!$search_category) { + _acquia_cms_search_add_category_facet(); + } } } -/** - * Implements hook_module_preinstall(). - */ -function acquia_cms_search_module_preinstall($module) { - \Drupal::service('acquia_cms_common.utility')->setModulePreinstallTriggered($module); -} - /** * Added enforced dependency in site studio templates for Acquia CMS Search. * diff --git a/modules/acquia_cms_search/acquia_cms_search.module b/modules/acquia_cms_search/acquia_cms_search.module index 06f3a9de6..e604147c0 100644 --- a/modules/acquia_cms_search/acquia_cms_search.module +++ b/modules/acquia_cms_search/acquia_cms_search.module @@ -65,6 +65,19 @@ function acquia_cms_search_views_plugins_cache_alter(&$definitions) { */ function acquia_cms_search_node_type_insert(NodeTypeInterface $node_type) { Drupal::classResolver(SearchFacade::class)->addNodeType($node_type); + if (!$node_type->isSyncing()) { + _acquia_cms_search_add_category_facet(); + } +} + +/** + * Implements hook_ENTITY_TYPE_insert() for node types. + */ +function acquia_cms_search_node_type_update(NodeTypeInterface $node_type) { + Drupal::classResolver(SearchFacade::class)->addNodeType($node_type); + if (!$node_type->isSyncing()) { + _acquia_cms_search_add_category_facet(); + } } /** @@ -76,12 +89,6 @@ function acquia_cms_search_field_config_insert(FieldConfigInterface $field_confi // Adding the third party settings in the node.body storage configuration to // index the body field for searching. - if ($field_storage->getType() === 'text_with_summary' && $field_storage->id() === 'node.body') { - $field_storage->setThirdPartySetting('acquia_cms_common', 'search_index', 'content') - ->setThirdPartySetting('acquia_cms_common', 'search_label', 'Body') - ->save(); - } - if ($field_storage->getType() === 'entity_reference' && $field_storage->getSetting('target_type') === 'taxonomy_term') { Drupal::classResolver(SearchFacade::class)->addTaxonomyField($field_storage); } @@ -136,34 +143,17 @@ function acquia_cms_search_search_api_server_insert(ServerInterface $server) { } // If the index wants to opt into using this server, grant its wish. - $server_name = $index->getThirdPartySetting('acquia_cms_common', 'search_server'); + $server_name = $index->getThirdPartySetting('acquia_cms_search', 'search_server'); if ($server_name && $server->id() === $server_name) { $index->setServer($server) ->enable() // The third-party setting is only needed once. - ->unsetThirdPartySetting('acquia_cms_common', 'search_server') + ->unsetThirdPartySetting('acquia_cms_search', 'search_server') ->save(); } } } -/** - * Implements hook_config_schema_info_alter(). - */ -function acquia_cms_search_config_schema_info_alter(array &$definitions) { - $key = 'node.type.*.third_party.acquia_cms_common'; - // Allow node types to carry a 'search_index' setting. This is used by our - // facade to passively opt the node type into a particular index. - // @see acquia_cms_search_node_type_insert() - // @see \Drupal\acquia_cms_search\Facade\SearchFacade::addNodeType() - if (array_key_exists($key, $definitions)) { - $definitions[$key]['mapping']['search_index'] = [ - 'type' => 'string', - 'label' => 'The machine name of the search index to which this content type should be added', - ]; - } -} - /** * Implements hook_ENTITY_TYPE_update(). */ @@ -180,26 +170,12 @@ function acquia_cms_search_form_acquia_cms_search_form_alter(array &$form) { $form['#submit'][] = AcquiaSearchFacade::class . '::submitSettingsForm'; } -/** - * Implements hook_modules_installed(). - */ -function acquia_cms_search_modules_installed(array $modules, $is_syncing) { - if (!$is_syncing) { - _acquia_cms_search_add_category_facet($modules); - } -} - /** * Adds search_category facet, if any acms search dependent module is installed. - * - * @param array $modules - * An array of installed modules. */ -function _acquia_cms_search_add_category_facet(array $modules) { - $acquiaCmsSearchModules = ["acquia_cms_person", "acquia_cms_place", - "acquia_cms_article", "acquia_cms_event", "acquia_cms_page", - ]; - if (array_intersect($acquiaCmsSearchModules, $modules)) { +function _acquia_cms_search_add_category_facet() { + $search_category = \Drupal::entityTypeManager()->getStorage('facets_facet')->loadByProperties(['id' => 'search_category']); + if (!$search_category) { \Drupal::classResolver(FacetFacade::class)->addFacet([ 'id' => 'search_category', 'name' => 'Category', diff --git a/modules/acquia_cms_search/composer.json b/modules/acquia_cms_search/composer.json index a83874e2e..5dcfaf4d5 100644 --- a/modules/acquia_cms_search/composer.json +++ b/modules/acquia_cms_search/composer.json @@ -4,8 +4,6 @@ "license": "GPL-2.0-or-later", "type": "drupal-module", "require": { - "cweagans/composer-patches": "^1.7", - "drupal/acquia_cms_common": "^1.9 || ^2.1 || ^3.1", "drupal/acquia_search": "^3.1", "drupal/collapsiblock": "^4.0", "drupal/facets": "^2.0", diff --git a/modules/acquia_cms_search/config/optional/block.block.clear_facet_filters.yml b/modules/acquia_cms_search/config/optional/block.block.clear_facet_filters.yml index 90b47eb82..87f3ab9fb 100644 --- a/modules/acquia_cms_search/config/optional/block.block.clear_facet_filters.yml +++ b/modules/acquia_cms_search/config/optional/block.block.clear_facet_filters.yml @@ -3,16 +3,10 @@ status: true dependencies: module: - acquia_cms_search - - cohesion - collapsiblock - theme: - - cohesion_theme -third_party_settings: - collapsiblock: - collapse_action: 0 id: clear_facet_filters -theme: cohesion_theme -region: dx8_hidden +theme: olivero +region: sidebar weight: 0 provider: null plugin: clear_facet_filters @@ -22,7 +16,7 @@ settings: label_display: '0' provider: acquia_cms_search visibility: - cohesion_master_template: - id: cohesion_master_template + request_path: + id: request_path negate: false - using_master_template: 0 + pages: "/articles\r\n/events\r\n/places\r\n/people" diff --git a/modules/acquia_cms_search/config/optional/block.block.exposed_form_search.yml b/modules/acquia_cms_search/config/optional/block.block.exposed_form_search.yml index 1694dd340..d7bc3b847 100644 --- a/modules/acquia_cms_search/config/optional/block.block.exposed_form_search.yml +++ b/modules/acquia_cms_search/config/optional/block.block.exposed_form_search.yml @@ -4,13 +4,10 @@ dependencies: config: - views.view.search module: - - cohesion - views - theme: - - cohesion_theme id: exposed_form_search -theme: cohesion_theme -region: dx8_hidden +theme: olivero +region: sidebar weight: 0 provider: null plugin: 'views_exposed_filter_block:search-search' @@ -21,7 +18,7 @@ settings: provider: views views_label: '' visibility: - cohesion_master_template: - id: cohesion_master_template + request_path: + id: request_path negate: false - using_master_template: 0 + pages: "/search" diff --git a/modules/acquia_cms_search/config/optional/block.block.search_category.yml b/modules/acquia_cms_search/config/optional/block.block.search_category.yml index 3cfd5a2cd..7d9d46b3e 100644 --- a/modules/acquia_cms_search/config/optional/block.block.search_category.yml +++ b/modules/acquia_cms_search/config/optional/block.block.search_category.yml @@ -4,17 +4,14 @@ dependencies: config: - facets.facet.search_category module: - - cohesion - collapsiblock - facets - theme: - - cohesion_theme third_party_settings: collapsiblock: collapse_action: 2 id: search_category -theme: cohesion_theme -region: dx8_hidden +theme: olivero +region: sidebar weight: 0 provider: null plugin: 'facet_block:search_category' @@ -25,7 +22,7 @@ settings: provider: facets block_id: search_category visibility: - cohesion_master_template: - id: cohesion_master_template + request_path: + id: request_path negate: false - using_master_template: 0 + pages: "/search" diff --git a/modules/acquia_cms_search/config/optional/block.block.search_content_type.yml b/modules/acquia_cms_search/config/optional/block.block.search_content_type.yml index 41370f512..b0a84d10f 100644 --- a/modules/acquia_cms_search/config/optional/block.block.search_content_type.yml +++ b/modules/acquia_cms_search/config/optional/block.block.search_content_type.yml @@ -4,17 +4,14 @@ dependencies: config: - facets.facet.search_content_type module: - - cohesion - collapsiblock - facets - theme: - - cohesion_theme third_party_settings: collapsiblock: collapse_action: 2 id: search_content_type -theme: cohesion_theme -region: dx8_hidden +theme: olivero +region: sidebar weight: 0 provider: null plugin: 'facet_block:search_content_type' @@ -25,7 +22,7 @@ settings: provider: facets block_id: search_content_type visibility: - cohesion_master_template: - id: cohesion_master_template + request_path: + id: request_path negate: false - using_master_template: 0 + pages: "/search" diff --git a/modules/acquia_cms_search/config/install/search_api.index.content.yml b/modules/acquia_cms_search/config/optional/search_api.index.content.yml similarity index 97% rename from modules/acquia_cms_search/config/install/search_api.index.content.yml rename to modules/acquia_cms_search/config/optional/search_api.index.content.yml index ab47530fd..5bff5dcdf 100644 --- a/modules/acquia_cms_search/config/install/search_api.index.content.yml +++ b/modules/acquia_cms_search/config/optional/search_api.index.content.yml @@ -9,9 +9,6 @@ dependencies: enforced: module: - acquia_cms_search -third_party_settings: - acquia_cms_common: - search_server: database id: content name: Content description: 'An index of all content in your site.' diff --git a/modules/acquia_cms_search/config/install/search_api_autocomplete.search.search.yml b/modules/acquia_cms_search/config/optional/search_api_autocomplete.search.search.yml similarity index 100% rename from modules/acquia_cms_search/config/install/search_api_autocomplete.search.search.yml rename to modules/acquia_cms_search/config/optional/search_api_autocomplete.search.search.yml diff --git a/modules/acquia_cms_search/config/optional/views.view.acquia_search.yml b/modules/acquia_cms_search/config/optional/views.view.acquia_search.yml index b892b7c9c..5f44dab07 100644 --- a/modules/acquia_cms_search/config/optional/views.view.acquia_search.yml +++ b/modules/acquia_cms_search/config/optional/views.view.acquia_search.yml @@ -6,10 +6,10 @@ dependencies: - search_api.index.acquia_search_index - system.menu.main module: + - acquia_search - search_api - text - user - - acquia_cms_development id: acquia_search label: 'Acquia Search Solr' module: views diff --git a/modules/acquia_cms_search/config/install/views.view.search.yml b/modules/acquia_cms_search/config/optional/views.view.search.yml similarity index 99% rename from modules/acquia_cms_search/config/install/views.view.search.yml rename to modules/acquia_cms_search/config/optional/views.view.search.yml index 438d9f737..b8654a8a1 100644 --- a/modules/acquia_cms_search/config/install/views.view.search.yml +++ b/modules/acquia_cms_search/config/optional/views.view.search.yml @@ -5,7 +5,6 @@ dependencies: - search_api.index.content - views.view.search_fallback module: - - acquia_cms_search - search_api - user id: search diff --git a/modules/acquia_cms_search/config/install/views.view.search_fallback.yml b/modules/acquia_cms_search/config/optional/views.view.search_fallback.yml similarity index 100% rename from modules/acquia_cms_search/config/install/views.view.search_fallback.yml rename to modules/acquia_cms_search/config/optional/views.view.search_fallback.yml diff --git a/modules/acquia_cms_search/config/schema/acquia_cms_search.schema.yml b/modules/acquia_cms_search/config/schema/acquia_cms_search.schema.yml index 649f43c31..239c899fe 100644 --- a/modules/acquia_cms_search/config/schema/acquia_cms_search.schema.yml +++ b/modules/acquia_cms_search/config/schema/acquia_cms_search.schema.yml @@ -1,4 +1,4 @@ -search_api.index.*.third_party.acquia_cms_common: +search_api.index.*.third_party.acquia_cms_search: type: mapping label: 'Acquia CMS settings' mapping: @@ -6,3 +6,11 @@ search_api.index.*.third_party.acquia_cms_common: search_server: type: string label: 'Machine name of Search API server to which the index will be attached' + +node.type.*.third_party.acquia_cms_search: + type: mapping + label: 'Search settings' + mapping: + search_index: + type: string + label: 'Machine name of Search API index to which the index will be attached' diff --git a/modules/acquia_cms_search/src/Facade/SearchFacade.php b/modules/acquia_cms_search/src/Facade/SearchFacade.php index 6e37ab75f..1ecac4566 100644 --- a/modules/acquia_cms_search/src/Facade/SearchFacade.php +++ b/modules/acquia_cms_search/src/Facade/SearchFacade.php @@ -179,8 +179,7 @@ public function addTaxonomyField(FieldStorageConfigInterface $field_storage) { // Field storages don't normally have a human-readable label, so allow it to // provide one in its third-party settings. - $field_label = $field_storage->getThirdPartySetting('acquia_cms_common', 'search_label') ?: $field_storage->getLabel(); - + $field_label = $field_storage->getThirdPartySetting('acquia_cms_search', 'search_label') ?: $field_storage->getLabel(); $data_source_id = 'entity:' . $field_storage->getTargetEntityTypeId(); // This will throw an exception if the data source doesn't exist, so this // is really just a way to prevent the field from using an invalid data @@ -223,9 +222,7 @@ public function addFields(FieldStorageConfigInterface $field_storage) { if (empty($index)) { return; } - $field_name = $field_storage->getName(); - // Bail out if the field already exists on the index. if ($index->getField($field_name)) { return; @@ -234,7 +231,7 @@ public function addFields(FieldStorageConfigInterface $field_storage) { $field_type = $field_storage->getType(); // Field storages don't normally have a human-readable label, so allow it to // provide one in its third-party settings. - $field_label = $field_storage->getThirdPartySetting('acquia_cms_common', 'search_label') ?: $field_storage->getLabel(); + $field_label = $field_storage->getThirdPartySetting('acquia_cms_search', 'search_label') ?: $field_storage->getLabel(); $data_source_id = 'entity:' . $field_storage->getTargetEntityTypeId(); // This will throw an exception if the data source doesn't exist, so this @@ -286,7 +283,7 @@ private function loadIndexFromSettings(ThirdPartySettingsInterface $object) : ?I if ($this->configInstaller->isSyncing()) { return NULL; } - $index = $object->getThirdPartySetting('acquia_cms_common', 'search_index'); + $index = $object->getThirdPartySetting('acquia_cms_search', 'search_index'); return $index ? $this->indexStorage->load($index) : NULL; } From 52028a57a5760bf91d2e15009ac6bac68e5ade32 Mon Sep 17 00:00:00 2001 From: rajeshreeputra Date: Mon, 30 Dec 2024 12:35:54 +0530 Subject: [PATCH 02/18] ACMS-4246: Update third party settings for content types modules. --- .../config/optional/field.storage.node.field_article_type.yml | 2 +- .../acquia_cms_article/config/optional/node.type.article.yml | 3 ++- .../config/optional/field.storage.node.field_categories.yml | 2 +- .../config/optional/field.storage.node.field_door_time.yml | 2 +- .../optional/field.storage.node.field_event_duration.yml | 2 +- .../config/optional/field.storage.node.field_event_end.yml | 2 +- .../config/optional/field.storage.node.field_event_start.yml | 2 +- .../config/optional/field.storage.node.field_event_type.yml | 2 +- modules/acquia_cms_event/config/optional/node.type.event.yml | 3 ++- modules/acquia_cms_page/config/optional/node.type.page.yml | 3 ++- .../config/optional/field.storage.node.field_email.yml | 2 +- .../config/optional/field.storage.node.field_job_title.yml | 2 +- .../optional/field.storage.node.field_person_telephone.yml | 2 +- .../config/optional/field.storage.node.field_person_type.yml | 2 +- modules/acquia_cms_person/config/optional/node.type.person.yml | 3 ++- .../config/optional/field.storage.node.field_place_address.yml | 2 +- .../optional/field.storage.node.field_place_telephone.yml | 2 +- .../config/optional/field.storage.node.field_place_type.yml | 2 +- modules/acquia_cms_place/config/optional/node.type.place.yml | 3 ++- 19 files changed, 24 insertions(+), 19 deletions(-) diff --git a/modules/acquia_cms_article/config/optional/field.storage.node.field_article_type.yml b/modules/acquia_cms_article/config/optional/field.storage.node.field_article_type.yml index 75a1e04ec..e29933e78 100644 --- a/modules/acquia_cms_article/config/optional/field.storage.node.field_article_type.yml +++ b/modules/acquia_cms_article/config/optional/field.storage.node.field_article_type.yml @@ -8,7 +8,7 @@ dependencies: module: - acquia_cms_article third_party_settings: - acquia_cms_common: + acquia_cms_search: search_index: content search_label: 'Article Type' id: node.field_article_type diff --git a/modules/acquia_cms_article/config/optional/node.type.article.yml b/modules/acquia_cms_article/config/optional/node.type.article.yml index e2b3e26e8..abd82e4a2 100644 --- a/modules/acquia_cms_article/config/optional/node.type.article.yml +++ b/modules/acquia_cms_article/config/optional/node.type.article.yml @@ -5,6 +5,8 @@ dependencies: module: - acquia_cms_article third_party_settings: + acquia_cms_search: + search_index: content acquia_cms_common: workflow_id: editorial workbench_email_templates: @@ -18,7 +20,6 @@ third_party_settings: open_graph: open_graph schema_article: schema_article twitter_cards: twitter_cards - search_index: content subtype: field: field_article_type facet: articles_article_type diff --git a/modules/acquia_cms_common/config/optional/field.storage.node.field_categories.yml b/modules/acquia_cms_common/config/optional/field.storage.node.field_categories.yml index f51c716c6..4a88f9cbd 100644 --- a/modules/acquia_cms_common/config/optional/field.storage.node.field_categories.yml +++ b/modules/acquia_cms_common/config/optional/field.storage.node.field_categories.yml @@ -5,7 +5,7 @@ dependencies: - node - taxonomy third_party_settings: - acquia_cms_common: + acquia_cms_search: search_index: content search_label: Categories id: node.field_categories diff --git a/modules/acquia_cms_event/config/optional/field.storage.node.field_door_time.yml b/modules/acquia_cms_event/config/optional/field.storage.node.field_door_time.yml index c5b9428fc..c22465ff5 100644 --- a/modules/acquia_cms_event/config/optional/field.storage.node.field_door_time.yml +++ b/modules/acquia_cms_event/config/optional/field.storage.node.field_door_time.yml @@ -8,7 +8,7 @@ dependencies: module: - acquia_cms_event third_party_settings: - acquia_cms_common: + acquia_cms_search: search_index: content search_label: 'Door Time' id: node.field_door_time diff --git a/modules/acquia_cms_event/config/optional/field.storage.node.field_event_duration.yml b/modules/acquia_cms_event/config/optional/field.storage.node.field_event_duration.yml index f048fd71e..9b95cdd50 100644 --- a/modules/acquia_cms_event/config/optional/field.storage.node.field_event_duration.yml +++ b/modules/acquia_cms_event/config/optional/field.storage.node.field_event_duration.yml @@ -7,7 +7,7 @@ dependencies: module: - acquia_cms_event third_party_settings: - acquia_cms_common: + acquia_cms_search: search_index: content search_label: 'Event Duration' id: node.field_event_duration diff --git a/modules/acquia_cms_event/config/optional/field.storage.node.field_event_end.yml b/modules/acquia_cms_event/config/optional/field.storage.node.field_event_end.yml index 65f3bc743..31980255f 100644 --- a/modules/acquia_cms_event/config/optional/field.storage.node.field_event_end.yml +++ b/modules/acquia_cms_event/config/optional/field.storage.node.field_event_end.yml @@ -8,7 +8,7 @@ dependencies: module: - acquia_cms_event third_party_settings: - acquia_cms_common: + acquia_cms_search: search_index: content search_label: 'Event End Date' id: node.field_event_end diff --git a/modules/acquia_cms_event/config/optional/field.storage.node.field_event_start.yml b/modules/acquia_cms_event/config/optional/field.storage.node.field_event_start.yml index a6a4c2dc9..59a61eae0 100644 --- a/modules/acquia_cms_event/config/optional/field.storage.node.field_event_start.yml +++ b/modules/acquia_cms_event/config/optional/field.storage.node.field_event_start.yml @@ -8,7 +8,7 @@ dependencies: module: - acquia_cms_event third_party_settings: - acquia_cms_common: + acquia_cms_search: search_index: content search_label: 'Event Start Date' id: node.field_event_start diff --git a/modules/acquia_cms_event/config/optional/field.storage.node.field_event_type.yml b/modules/acquia_cms_event/config/optional/field.storage.node.field_event_type.yml index 28272988b..5622a5c19 100644 --- a/modules/acquia_cms_event/config/optional/field.storage.node.field_event_type.yml +++ b/modules/acquia_cms_event/config/optional/field.storage.node.field_event_type.yml @@ -8,7 +8,7 @@ dependencies: module: - acquia_cms_event third_party_settings: - acquia_cms_common: + acquia_cms_search: search_index: content search_label: 'Event Type' id: node.field_event_type diff --git a/modules/acquia_cms_event/config/optional/node.type.event.yml b/modules/acquia_cms_event/config/optional/node.type.event.yml index 56ee044cd..e4792ca21 100644 --- a/modules/acquia_cms_event/config/optional/node.type.event.yml +++ b/modules/acquia_cms_event/config/optional/node.type.event.yml @@ -5,6 +5,8 @@ dependencies: module: - acquia_cms_event third_party_settings: + acquia_cms_search: + search_index: content acquia_cms_common: workflow_id: editorial workbench_email_templates: @@ -22,7 +24,6 @@ third_party_settings: field: field_event_type facet: events_event_type sitemap_variant: default - search_index: content menu_ui: available_menus: - main diff --git a/modules/acquia_cms_page/config/optional/node.type.page.yml b/modules/acquia_cms_page/config/optional/node.type.page.yml index dfb122148..205c5c614 100644 --- a/modules/acquia_cms_page/config/optional/node.type.page.yml +++ b/modules/acquia_cms_page/config/optional/node.type.page.yml @@ -9,6 +9,8 @@ dependencies: module: - acquia_cms_page third_party_settings: + acquia_cms_search: + search_index: content acquia_cms_common: workflow_id: editorial workbench_email_templates: @@ -23,7 +25,6 @@ third_party_settings: schema_article: schema_article twitter_cards: twitter_cards sitemap_variant: default - search_index: content menu_ui: available_menus: - main diff --git a/modules/acquia_cms_person/config/optional/field.storage.node.field_email.yml b/modules/acquia_cms_person/config/optional/field.storage.node.field_email.yml index 576e90157..96a24fbe2 100644 --- a/modules/acquia_cms_person/config/optional/field.storage.node.field_email.yml +++ b/modules/acquia_cms_person/config/optional/field.storage.node.field_email.yml @@ -7,7 +7,7 @@ dependencies: module: - acquia_cms_person third_party_settings: - acquia_cms_common: + acquia_cms_search: search_index: content search_label: Email id: node.field_email diff --git a/modules/acquia_cms_person/config/optional/field.storage.node.field_job_title.yml b/modules/acquia_cms_person/config/optional/field.storage.node.field_job_title.yml index 9b12d788c..c2add4daa 100644 --- a/modules/acquia_cms_person/config/optional/field.storage.node.field_job_title.yml +++ b/modules/acquia_cms_person/config/optional/field.storage.node.field_job_title.yml @@ -7,7 +7,7 @@ dependencies: module: - acquia_cms_person third_party_settings: - acquia_cms_common: + acquia_cms_search: search_index: content search_label: Job Title id: node.field_job_title diff --git a/modules/acquia_cms_person/config/optional/field.storage.node.field_person_telephone.yml b/modules/acquia_cms_person/config/optional/field.storage.node.field_person_telephone.yml index 6e2ab8b3c..24b6e119c 100644 --- a/modules/acquia_cms_person/config/optional/field.storage.node.field_person_telephone.yml +++ b/modules/acquia_cms_person/config/optional/field.storage.node.field_person_telephone.yml @@ -8,7 +8,7 @@ dependencies: module: - acquia_cms_person third_party_settings: - acquia_cms_common: + acquia_cms_search: search_index: content search_label: 'Person Telephone' id: node.field_person_telephone diff --git a/modules/acquia_cms_person/config/optional/field.storage.node.field_person_type.yml b/modules/acquia_cms_person/config/optional/field.storage.node.field_person_type.yml index 03d91426d..f5a3ae5b2 100644 --- a/modules/acquia_cms_person/config/optional/field.storage.node.field_person_type.yml +++ b/modules/acquia_cms_person/config/optional/field.storage.node.field_person_type.yml @@ -8,7 +8,7 @@ dependencies: module: - acquia_cms_person third_party_settings: - acquia_cms_common: + acquia_cms_search: search_index: content search_label: 'Person Type' id: node.field_person_type diff --git a/modules/acquia_cms_person/config/optional/node.type.person.yml b/modules/acquia_cms_person/config/optional/node.type.person.yml index 0657a99af..f28eb408e 100644 --- a/modules/acquia_cms_person/config/optional/node.type.person.yml +++ b/modules/acquia_cms_person/config/optional/node.type.person.yml @@ -5,6 +5,8 @@ dependencies: module: - acquia_cms_person third_party_settings: + acquia_cms_search: + search_index: content acquia_cms_common: workflow_id: editorial workbench_email_templates: @@ -22,7 +24,6 @@ third_party_settings: field: field_person_type facet: people_person_type sitemap_variant: default - search_index: content menu_ui: available_menus: - main diff --git a/modules/acquia_cms_place/config/optional/field.storage.node.field_place_address.yml b/modules/acquia_cms_place/config/optional/field.storage.node.field_place_address.yml index 69a2fc3e9..e06e137b2 100644 --- a/modules/acquia_cms_place/config/optional/field.storage.node.field_place_address.yml +++ b/modules/acquia_cms_place/config/optional/field.storage.node.field_place_address.yml @@ -8,7 +8,7 @@ dependencies: module: - acquia_cms_place third_party_settings: - acquia_cms_common: + acquia_cms_search: search_index: content search_label: 'Place Address' id: node.field_place_address diff --git a/modules/acquia_cms_place/config/optional/field.storage.node.field_place_telephone.yml b/modules/acquia_cms_place/config/optional/field.storage.node.field_place_telephone.yml index 2c7501052..a25c988ba 100644 --- a/modules/acquia_cms_place/config/optional/field.storage.node.field_place_telephone.yml +++ b/modules/acquia_cms_place/config/optional/field.storage.node.field_place_telephone.yml @@ -8,7 +8,7 @@ dependencies: module: - acquia_cms_place third_party_settings: - acquia_cms_common: + acquia_cms_search: search_index: content search_label: 'Place Telephone' id: node.field_place_telephone diff --git a/modules/acquia_cms_place/config/optional/field.storage.node.field_place_type.yml b/modules/acquia_cms_place/config/optional/field.storage.node.field_place_type.yml index 5cb77ad2a..abaf6f54b 100644 --- a/modules/acquia_cms_place/config/optional/field.storage.node.field_place_type.yml +++ b/modules/acquia_cms_place/config/optional/field.storage.node.field_place_type.yml @@ -8,7 +8,7 @@ dependencies: module: - acquia_cms_place third_party_settings: - acquia_cms_common: + acquia_cms_search: search_index: content search_label: 'Place Type' id: node.field_place_type diff --git a/modules/acquia_cms_place/config/optional/node.type.place.yml b/modules/acquia_cms_place/config/optional/node.type.place.yml index ddd8dd153..bc8141cbb 100644 --- a/modules/acquia_cms_place/config/optional/node.type.place.yml +++ b/modules/acquia_cms_place/config/optional/node.type.place.yml @@ -5,6 +5,8 @@ dependencies: module: - acquia_cms_place third_party_settings: + acquia_cms_search: + search_index: content acquia_cms_common: workflow_id: editorial workbench_email_templates: @@ -22,7 +24,6 @@ third_party_settings: field: field_place_type facet: places_place_type sitemap_variant: default - search_index: content menu_ui: available_menus: - main From 88994f95ea21880a99d6907797d6ea9d2b16f45b Mon Sep 17 00:00:00 2001 From: rajeshreeputra Date: Mon, 30 Dec 2024 13:07:15 +0530 Subject: [PATCH 03/18] ACMS-4246: Add field storage schema in search for content types. --- .../config/schema/acquia_cms_common.schema.yml | 15 --------------- .../config/schema/acquia_cms_search.schema.yml | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/modules/acquia_cms_common/config/schema/acquia_cms_common.schema.yml b/modules/acquia_cms_common/config/schema/acquia_cms_common.schema.yml index a7129c430..d989799be 100644 --- a/modules/acquia_cms_common/config/schema/acquia_cms_common.schema.yml +++ b/modules/acquia_cms_common/config/schema/acquia_cms_common.schema.yml @@ -38,21 +38,6 @@ node.type.*.third_party.acquia_cms_common: type: string label: 'Machine name of the sitemap variant where the content type will be added' -field.storage.*.*.third_party.acquia_cms_common: - type: mapping - label: 'Acquia CMS settings' - mapping: - # Allow fields to carry 'search_index' and 'search_label' settings. This is used - # by our facade to passively opt the field into a particular index. - # @see acquia_cms_search_field_storage_config_insert() - # @see \Drupal\acquia_cms_search\Facade\SearchFacade::addTaxonomyField() - search_index: - type: string - label: 'Machine name of Search API index to which this field should be added' - search_label: - type: string - label: 'The label of the field in the Search API index' - acquia_cms_common.settings: type: config_object label: 'Acquia CMS settings' diff --git a/modules/acquia_cms_search/config/schema/acquia_cms_search.schema.yml b/modules/acquia_cms_search/config/schema/acquia_cms_search.schema.yml index 239c899fe..a336c8a4c 100644 --- a/modules/acquia_cms_search/config/schema/acquia_cms_search.schema.yml +++ b/modules/acquia_cms_search/config/schema/acquia_cms_search.schema.yml @@ -14,3 +14,18 @@ node.type.*.third_party.acquia_cms_search: search_index: type: string label: 'Machine name of Search API index to which the index will be attached' + +field.storage.*.*.third_party.acquia_cms_search: + type: mapping + label: 'Acquia CMS settings' + mapping: + # Allow fields to carry 'search_index' and 'search_label' settings. This is used + # by our facade to passively opt the field into a particular index. + # @see acquia_cms_search_field_storage_config_insert() + # @see \Drupal\acquia_cms_search\Facade\SearchFacade::addTaxonomyField() + search_index: + type: string + label: 'Machine name of Search API index to which this field should be added' + search_label: + type: string + label: 'The label of the field in the Search API index' From ca183c283f1f33afe57c465359bcc41bb6a16924 Mon Sep 17 00:00:00 2001 From: rajeshreeputra Date: Mon, 30 Dec 2024 13:26:26 +0530 Subject: [PATCH 04/18] ACMS-4246: Move search view for content to search. --- .../config/optional/views.view.articles.yml | 1 - .../config/optional/views.view.events.yml | 0 .../config/optional/views.view.people.yml | 0 .../config/optional/views.view.places.yml | 0 4 files changed, 1 deletion(-) rename modules/{acquia_cms_article => acquia_cms_search}/config/optional/views.view.articles.yml (99%) rename modules/{acquia_cms_event => acquia_cms_search}/config/optional/views.view.events.yml (100%) rename modules/{acquia_cms_person => acquia_cms_search}/config/optional/views.view.people.yml (100%) rename modules/{acquia_cms_place => acquia_cms_search}/config/optional/views.view.places.yml (100%) diff --git a/modules/acquia_cms_article/config/optional/views.view.articles.yml b/modules/acquia_cms_search/config/optional/views.view.articles.yml similarity index 99% rename from modules/acquia_cms_article/config/optional/views.view.articles.yml rename to modules/acquia_cms_search/config/optional/views.view.articles.yml index 569b6d36b..777fea2d1 100644 --- a/modules/acquia_cms_article/config/optional/views.view.articles.yml +++ b/modules/acquia_cms_search/config/optional/views.view.articles.yml @@ -6,7 +6,6 @@ dependencies: - search_api.index.content - views.view.articles_fallback module: - - acquia_cms_common - acquia_cms_search - search_api - user diff --git a/modules/acquia_cms_event/config/optional/views.view.events.yml b/modules/acquia_cms_search/config/optional/views.view.events.yml similarity index 100% rename from modules/acquia_cms_event/config/optional/views.view.events.yml rename to modules/acquia_cms_search/config/optional/views.view.events.yml diff --git a/modules/acquia_cms_person/config/optional/views.view.people.yml b/modules/acquia_cms_search/config/optional/views.view.people.yml similarity index 100% rename from modules/acquia_cms_person/config/optional/views.view.people.yml rename to modules/acquia_cms_search/config/optional/views.view.people.yml diff --git a/modules/acquia_cms_place/config/optional/views.view.places.yml b/modules/acquia_cms_search/config/optional/views.view.places.yml similarity index 100% rename from modules/acquia_cms_place/config/optional/views.view.places.yml rename to modules/acquia_cms_search/config/optional/views.view.places.yml From 3aa5fa184af24547419e3c2c009471922903b198 Mon Sep 17 00:00:00 2001 From: rajeshreeputra Date: Mon, 30 Dec 2024 15:21:44 +0530 Subject: [PATCH 05/18] ACMS-4246: Add helper method to import view on node type creation and update. --- .../acquia_cms_search.module | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/modules/acquia_cms_search/acquia_cms_search.module b/modules/acquia_cms_search/acquia_cms_search.module index e604147c0..a1867f4b2 100644 --- a/modules/acquia_cms_search/acquia_cms_search.module +++ b/modules/acquia_cms_search/acquia_cms_search.module @@ -10,11 +10,13 @@ use Drupal\acquia_cms_search\Facade\FacetFacade; use Drupal\acquia_cms_search\Facade\SearchFacade; use Drupal\acquia_cms_search\Plugin\views\query\SearchApiQuery; use Drupal\acquia_search\Helper\Runtime; +use Drupal\Core\Config\FileStorage; use Drupal\Core\DestructableInterface; use Drupal\field\FieldConfigInterface; use Drupal\node\NodeTypeInterface; use Drupal\search_api\Entity\Index; use Drupal\search_api\ServerInterface; +use Drupal\views\Entity\View; /** * Implements hook_views_data(). @@ -68,6 +70,7 @@ function acquia_cms_search_node_type_insert(NodeTypeInterface $node_type) { if (!$node_type->isSyncing()) { _acquia_cms_search_add_category_facet(); } + _acquia_cms_search_import_content_type_views($node_type); } /** @@ -78,6 +81,7 @@ function acquia_cms_search_node_type_update(NodeTypeInterface $node_type) { if (!$node_type->isSyncing()) { _acquia_cms_search_add_category_facet(); } + _acquia_cms_search_import_content_type_views($node_type); } /** @@ -123,6 +127,27 @@ function acquia_cms_search_entity_insert() { } } +/** + * Import views for content types. + */ +function _acquia_cms_search_import_content_type_views(NodeTypeInterface $node_type){ + $content_views = [ + 'article' => 'articles', + 'event' => 'events', + 'person' => 'people', + 'place' => 'places', + ]; + // Load the view. + $view = View::load($content_views[$node_type->id()]); + if (!$view) { + // import the view. + $source = new FileStorage(__DIR__ . '/config/optional'); + $entity_storage = \Drupal::entityTypeManager()->getStorage('view'); + $entity = $entity_storage->createFromStorageRecord($source->read('views.view.' . $content_views[$node_type->id()])); + $entity->save(); + } +} + /** * Implements hook_ENTITY_TYPE_insert() for Search API servers. */ From 23dd60e33d094eca9bbfd066423d29e0ea7a76e3 Mon Sep 17 00:00:00 2001 From: rajeshreeputra Date: Mon, 30 Dec 2024 17:42:54 +0530 Subject: [PATCH 06/18] ACMS-4246: Add the dependency check for view config import. --- .../acquia_cms_search.install | 1 + .../acquia_cms_search.module | 47 ++++++++++++++++++- 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/modules/acquia_cms_search/acquia_cms_search.install b/modules/acquia_cms_search/acquia_cms_search.install index 563fa3352..b943f1eca 100644 --- a/modules/acquia_cms_search/acquia_cms_search.install +++ b/modules/acquia_cms_search/acquia_cms_search.install @@ -26,6 +26,7 @@ function acquia_cms_search_install($is_syncing) { // this module was installed. $node_types = \Drupal::entityTypeManager()->getStorage('node_type')->loadMultiple(); array_walk($node_types, 'acquia_cms_search_node_type_insert'); + array_walk($node_types, '_acquia_cms_search_import_content_type_views'); $search_category = \Drupal::entityTypeManager()->getStorage('facets_facet')->loadByProperties(['id' => 'search_category']); if (!$search_category) { _acquia_cms_search_add_category_facet(); diff --git a/modules/acquia_cms_search/acquia_cms_search.module b/modules/acquia_cms_search/acquia_cms_search.module index a1867f4b2..6dc028d24 100644 --- a/modules/acquia_cms_search/acquia_cms_search.module +++ b/modules/acquia_cms_search/acquia_cms_search.module @@ -111,6 +111,17 @@ function acquia_cms_search_field_config_insert(FieldConfigInterface $field_confi if (in_array($field_storage->getType(), $allowed_fields_type)) { Drupal::classResolver(SearchFacade::class)->addFields($field_storage); } + + // Insert view on config import. + $configs = [ + 'node.article.field_article_type' => 'article', + 'node.event.field_event_type' => 'event', + 'node.person.field_person_type' => 'person', + 'node.place.field_place_type' => 'place', + ]; + if (in_array($field_config->id(), array_keys($configs))) { + _acquia_cms_search_import_content_type_views(\Drupal::entityTypeManager()->getStorage('node_type')->load($configs[$field_config->id()])); + } } /** @@ -137,17 +148,51 @@ function _acquia_cms_search_import_content_type_views(NodeTypeInterface $node_ty 'person' => 'people', 'place' => 'places', ]; + if(!in_array($node_type->id(), array_keys($content_views))) { + return; + } // Load the view. $view = View::load($content_views[$node_type->id()]); if (!$view) { // import the view. $source = new FileStorage(__DIR__ . '/config/optional'); $entity_storage = \Drupal::entityTypeManager()->getStorage('view'); - $entity = $entity_storage->createFromStorageRecord($source->read('views.view.' . $content_views[$node_type->id()])); + $view_config = $source->read('views.view.' . $content_views[$node_type->id()]); + // Validate dependencies exist. + if (!empty($view_config['dependencies'])) { + $module_handler = \Drupal::service('module_handler'); + foreach ($view_config['dependencies']['module'] as $dependency) { + if (!$module_handler->moduleExists($dependency)) { + return; + } + } + foreach ($view_config['dependencies']['config'] as $dependency) { + if (!configExists($dependency)) { + return; + } + } + } + + // Create the view entity. + $entity = $entity_storage->createFromStorageRecord($view_config); $entity->save(); } } +/** + * Check if a configuration exists. + * + * @param string $config_name + * The name of the configuration to check. + * + * @return bool + * TRUE if the configuration exists, FALSE otherwise. + */ +function configExists($config_name) { + $config_factory = \Drupal::service('config.factory'); + return $config_factory->get($config_name)->isNew() === FALSE; +} + /** * Implements hook_ENTITY_TYPE_insert() for Search API servers. */ From 6006cfccc034340a520fc7b1623ab458f32a1e64 Mon Sep 17 00:00:00 2001 From: rajeshreeputra Date: Mon, 30 Dec 2024 19:30:12 +0530 Subject: [PATCH 07/18] ACMS-4246: Update search config to work with recipes. --- .../search_api.index.content.yml | 3 + .../search_api.server.database.yml | 0 .../search_api_autocomplete.search.search.yml | 34 ++ .../config/install/views.view.search.yml | 359 ++++++++++++++++++ .../views.view.search_fallback.yml | 0 .../src/Facade/SearchFacade.php | 2 +- 6 files changed, 397 insertions(+), 1 deletion(-) rename modules/acquia_cms_search/config/{optional => install}/search_api.index.content.yml (97%) rename modules/acquia_cms_search/config/{optional => install}/search_api.server.database.yml (100%) create mode 100644 modules/acquia_cms_search/config/install/search_api_autocomplete.search.search.yml create mode 100644 modules/acquia_cms_search/config/install/views.view.search.yml rename modules/acquia_cms_search/config/{optional => install}/views.view.search_fallback.yml (100%) diff --git a/modules/acquia_cms_search/config/optional/search_api.index.content.yml b/modules/acquia_cms_search/config/install/search_api.index.content.yml similarity index 97% rename from modules/acquia_cms_search/config/optional/search_api.index.content.yml rename to modules/acquia_cms_search/config/install/search_api.index.content.yml index 5bff5dcdf..ab47530fd 100644 --- a/modules/acquia_cms_search/config/optional/search_api.index.content.yml +++ b/modules/acquia_cms_search/config/install/search_api.index.content.yml @@ -9,6 +9,9 @@ dependencies: enforced: module: - acquia_cms_search +third_party_settings: + acquia_cms_common: + search_server: database id: content name: Content description: 'An index of all content in your site.' diff --git a/modules/acquia_cms_search/config/optional/search_api.server.database.yml b/modules/acquia_cms_search/config/install/search_api.server.database.yml similarity index 100% rename from modules/acquia_cms_search/config/optional/search_api.server.database.yml rename to modules/acquia_cms_search/config/install/search_api.server.database.yml diff --git a/modules/acquia_cms_search/config/install/search_api_autocomplete.search.search.yml b/modules/acquia_cms_search/config/install/search_api_autocomplete.search.search.yml new file mode 100644 index 000000000..789ff60b0 --- /dev/null +++ b/modules/acquia_cms_search/config/install/search_api_autocomplete.search.search.yml @@ -0,0 +1,34 @@ +langcode: en +status: true +dependencies: + config: + - search_api.index.content + - views.view.search + module: + - views + - search_api_autocomplete +id: search +label: Search +index_id: content +suggester_settings: + live_results: + fields: { } + view_modes: { } + server: + fields: { } +suggester_weights: + live_results: 0 + server: 0 +suggester_limits: { } +search_settings: + 'views:search': + displays: + default: true + selected: { } +options: + limit: 10 + min_length: 1 + show_count: false + delay: null + submit_button_selector: ':submit' + autosubmit: true diff --git a/modules/acquia_cms_search/config/install/views.view.search.yml b/modules/acquia_cms_search/config/install/views.view.search.yml new file mode 100644 index 000000000..438d9f737 --- /dev/null +++ b/modules/acquia_cms_search/config/install/views.view.search.yml @@ -0,0 +1,359 @@ +langcode: en +status: true +dependencies: + config: + - search_api.index.content + - views.view.search_fallback + module: + - acquia_cms_search + - search_api + - user +id: search +label: Search +module: views +description: '' +tag: '' +base_table: search_api_index_content +base_field: search_api_id +display: + default: + id: default + display_title: Master + display_plugin: default + position: 0 + display_options: + title: Search + fields: + rendered_item: + id: rendered_item + table: search_api_index_content + field: rendered_item + relationship: none + group_type: group + admin_label: '' + plugin_id: search_api + label: '' + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + link_to_item: false + use_highlighting: false + multi_type: separator + multi_separator: ', ' + pager: + type: full + options: + offset: 0 + pagination_heading_level: h4 + items_per_page: 10 + total_pages: null + id: 0 + tags: + next: 'Next ›' + previous: '‹ Previous' + first: '« First' + last: 'Last »' + expose: + items_per_page: false + items_per_page_label: 'Items per page' + items_per_page_options: '5, 10, 25, 50' + items_per_page_options_all: false + items_per_page_options_all_label: '- All -' + offset: false + offset_label: Offset + quantity: 3 + exposed_form: + type: basic + options: + submit_button: Search + reset_button: false + reset_button_label: Reset + exposed_sorts_label: 'Sort by' + expose_sort_order: true + sort_asc_label: Asc + sort_desc_label: Desc + access: + type: perm + options: + perm: 'access content' + cache: + type: search_api_tag + options: { } + empty: + view_fallback: + id: view_fallback + table: views + field: view_fallback + relationship: none + group_type: group + admin_label: '' + plugin_id: view_fallback + empty: true + view_to_insert: 'search_fallback:search_fallback_block' + inherit_arguments: 0 + main_listing_pages_view: + id: main_listing_pages_view + table: views + field: main_listing_pages_view + relationship: none + group_type: group + admin_label: '' + plugin_id: main_listing_pages_view + empty: true + tokenize: 0 + content: + value: 'Sorry, no content found. Please try to search with different keywords.' + format: filtered_html + sorts: + search_api_relevance: + id: search_api_relevance + table: search_api_index_content + field: search_api_relevance + relationship: none + group_type: group + admin_label: '' + plugin_id: search_api + order: DESC + expose: + label: '' + field_identifier: search_api_relevance + exposed: false + arguments: { } + filters: + search_api_fulltext: + id: search_api_fulltext + table: search_api_index_content + field: search_api_fulltext + relationship: none + group_type: group + admin_label: '' + plugin_id: search_api_fulltext + operator: or + value: '' + group: 1 + exposed: true + expose: + operator_id: search_api_fulltext_op + label: '' + description: '' + use_operator: false + operator: search_api_fulltext_op + operator_limit_selection: false + operator_list: { } + identifier: keywords + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + administrator: '0' + developer: '0' + site_builder: '0' + content_administrator: '0' + content_author: '0' + content_editor: '0' + user_administrator: '0' + anonymous: '0' + placeholder: '' + is_grouped: false + group_info: + label: '' + description: '' + identifier: '' + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: { } + parse_mode: terms + min_length: null + fields: { } + published: + id: published + table: search_api_index_content + field: published + relationship: none + group_type: group + admin_label: '' + plugin_id: search_api_boolean + operator: '=' + value: '1' + group: 1 + exposed: false + expose: + operator_id: '' + label: '' + description: '' + use_operator: false + operator: '' + operator_limit_selection: false + operator_list: { } + identifier: '' + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + is_grouped: false + group_info: + label: '' + description: '' + identifier: '' + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: { } + search_api_language: + id: search_api_language + table: search_api_index_content + field: search_api_language + relationship: none + group_type: group + admin_label: '' + plugin_id: search_api_language + operator: in + value: + '***LANGUAGE_language_interface***': '***LANGUAGE_language_interface***' + group: 1 + exposed: false + expose: + operator_id: '' + label: '' + description: '' + use_operator: false + operator: '' + operator_limit_selection: false + operator_list: { } + identifier: '' + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + reduce: false + is_grouped: false + group_info: + label: '' + description: '' + identifier: '' + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: { } + style: + type: default + row: + type: search_api + options: + view_modes: + 'entity:node': + article: teaser + event: teaser + page: teaser + person: teaser + place: teaser + query: + type: search_api_query + options: + bypass_access: false + skip_access: false + preserve_facet_query_args: false + relationships: { } + header: + result: + id: result + table: views + field: result + relationship: none + group_type: group + admin_label: '' + plugin_id: result + empty: false + content: '@end of @total results' + footer: { } + display_extenders: { } + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_interface' + - url + - url.path + - url.query_args + - 'user.node_grants:view' + - user.permissions + tags: + - 'config:search_api.index.content' + - 'search_api_list:content' + search: + id: search + display_title: Page + display_plugin: page + position: 1 + display_options: + cache: + type: search_api_tag + options: { } + defaults: + cache: false + exposed_block: true + display_extenders: { } + path: search + cache_metadata: + max-age: 0 + contexts: + - 'languages:language_interface' + - url + - url.path + - url.query_args + - 'user.node_grants:view' + - user.permissions + tags: + - 'config:facets.facet.search_content_type' + - 'config:search_api.index.content' + - 'config:views.view.search' + - 'search_api_list:content' diff --git a/modules/acquia_cms_search/config/optional/views.view.search_fallback.yml b/modules/acquia_cms_search/config/install/views.view.search_fallback.yml similarity index 100% rename from modules/acquia_cms_search/config/optional/views.view.search_fallback.yml rename to modules/acquia_cms_search/config/install/views.view.search_fallback.yml diff --git a/modules/acquia_cms_search/src/Facade/SearchFacade.php b/modules/acquia_cms_search/src/Facade/SearchFacade.php index 1ecac4566..3ab944227 100644 --- a/modules/acquia_cms_search/src/Facade/SearchFacade.php +++ b/modules/acquia_cms_search/src/Facade/SearchFacade.php @@ -283,7 +283,7 @@ private function loadIndexFromSettings(ThirdPartySettingsInterface $object) : ?I if ($this->configInstaller->isSyncing()) { return NULL; } - $index = $object->getThirdPartySetting('acquia_cms_search', 'search_index'); + $index = $object->getThirdPartySetting('acquia_cms_search', 'search_index') ?? $object->getThirdPartySetting('acquia_starterkit_core', 'search_index'); return $index ? $this->indexStorage->load($index) : NULL; } From bd88d8c1631fe98c58280580938a82435f0f54ee Mon Sep 17 00:00:00 2001 From: rajeshreeputra Date: Tue, 31 Dec 2024 14:19:51 +0530 Subject: [PATCH 08/18] ACMS-4246: Move MainListingPagesView to search from common. --- .../acquia_cms_common/acquia_cms_common.module | 17 ----------------- .../acquia_cms_search/acquia_cms_search.module | 7 +++++++ .../Plugin/views/area/MainListingPagesView.php | 2 +- 3 files changed, 8 insertions(+), 18 deletions(-) rename modules/{acquia_cms_common => acquia_cms_search}/src/Plugin/views/area/MainListingPagesView.php (96%) diff --git a/modules/acquia_cms_common/acquia_cms_common.module b/modules/acquia_cms_common/acquia_cms_common.module index dfb758bb9..a82b753ec 100644 --- a/modules/acquia_cms_common/acquia_cms_common.module +++ b/modules/acquia_cms_common/acquia_cms_common.module @@ -64,23 +64,6 @@ function acquia_cms_common_form_alter(&$form, FormStateInterface $form_state, $f } } -/** - * Implements hook_views_data(). - */ -function acquia_cms_common_views_data() { - return [ - 'views' => [ - 'main_listing_pages_view' => [ - 'title' => t('Main listing pages - Text area'), - 'help' => t('Insert a text area inside a main view listing pages if the search server is available. If the view is not based on a Search API index, this behaves like a standard text area.'), - 'area' => [ - 'id' => 'main_listing_pages_view', - ], - ], - ], - ]; -} - /** * Implements hook_theme(). */ diff --git a/modules/acquia_cms_search/acquia_cms_search.module b/modules/acquia_cms_search/acquia_cms_search.module index 6dc028d24..d69011bd5 100644 --- a/modules/acquia_cms_search/acquia_cms_search.module +++ b/modules/acquia_cms_search/acquia_cms_search.module @@ -31,6 +31,13 @@ function acquia_cms_search_views_data() { 'id' => 'view_fallback', ], ], + 'main_listing_pages_view' => [ + 'title' => t('Main listing pages - Text area'), + 'help' => t('Insert a text area inside a main view listing pages if the search server is available. If the view is not based on a Search API index, this behaves like a standard text area.'), + 'area' => [ + 'id' => 'main_listing_pages_view', + ], + ], ], ]; } diff --git a/modules/acquia_cms_common/src/Plugin/views/area/MainListingPagesView.php b/modules/acquia_cms_search/src/Plugin/views/area/MainListingPagesView.php similarity index 96% rename from modules/acquia_cms_common/src/Plugin/views/area/MainListingPagesView.php rename to modules/acquia_cms_search/src/Plugin/views/area/MainListingPagesView.php index e2c90e665..dd0666190 100644 --- a/modules/acquia_cms_common/src/Plugin/views/area/MainListingPagesView.php +++ b/modules/acquia_cms_search/src/Plugin/views/area/MainListingPagesView.php @@ -1,6 +1,6 @@ Date: Tue, 31 Dec 2024 14:15:58 +0530 Subject: [PATCH 09/18] ACMS-4246: Add helper method to import view on fallback view creation. --- .../acquia_cms_search.install | 5 ++- .../acquia_cms_search.module | 38 ++++++++++++++----- .../install/search_api.index.content.yml | 2 +- 3 files changed, 33 insertions(+), 12 deletions(-) diff --git a/modules/acquia_cms_search/acquia_cms_search.install b/modules/acquia_cms_search/acquia_cms_search.install index b943f1eca..3b1a07bea 100644 --- a/modules/acquia_cms_search/acquia_cms_search.install +++ b/modules/acquia_cms_search/acquia_cms_search.install @@ -24,10 +24,11 @@ function acquia_cms_search_install($is_syncing) { // Retroactively enable indexing for any content types that existed before // this module was installed. - $node_types = \Drupal::entityTypeManager()->getStorage('node_type')->loadMultiple(); + $entity_type_manager = \Drupal::entityTypeManager(); + $node_types = $entity_type_manager->getStorage('node_type')->loadMultiple(); array_walk($node_types, 'acquia_cms_search_node_type_insert'); array_walk($node_types, '_acquia_cms_search_import_content_type_views'); - $search_category = \Drupal::entityTypeManager()->getStorage('facets_facet')->loadByProperties(['id' => 'search_category']); + $search_category = $entity_type_manager->getStorage('facets_facet')->loadByProperties(['id' => 'search_category']); if (!$search_category) { _acquia_cms_search_add_category_facet(); } diff --git a/modules/acquia_cms_search/acquia_cms_search.module b/modules/acquia_cms_search/acquia_cms_search.module index d69011bd5..877004cd4 100644 --- a/modules/acquia_cms_search/acquia_cms_search.module +++ b/modules/acquia_cms_search/acquia_cms_search.module @@ -17,6 +17,7 @@ use Drupal\node\NodeTypeInterface; use Drupal\search_api\Entity\Index; use Drupal\search_api\ServerInterface; use Drupal\views\Entity\View; +use Drupal\views\ViewEntityInterface; /** * Implements hook_views_data(). @@ -132,16 +133,21 @@ function acquia_cms_search_field_config_insert(FieldConfigInterface $field_confi } /** - * Implements hook_entity_insert(). + * Implements hook_ENTITY_TYPE_insert() for node types. */ -function acquia_cms_search_entity_insert() { - // Normally, content is indexed immediately after it is created or modified, - // at the end of the current request. But that means content created - // programmatically (i.e., in the PHPUnit tests) are not being indexed. So, - // explicitly invoke the indexer whenever an entity is created. - $indexer = Drupal::service('search_api.post_request_indexing'); - if ($indexer instanceof DestructableInterface) { - $indexer->destruct(); +function acquia_cms_search_view_insert(ViewEntityInterface $view) { + $content_views = [ + 'articles_fallback' => 'article', + 'events_fallback' => 'event', + 'people_fallback' => 'person', + 'places_fallback' => 'place', + ]; + if(!in_array($view->id(), array_keys($content_views))) { + return; + } + if (!$view->isSyncing()) { + $node_type = \Drupal::entityTypeManager()->getStorage('node_type')->load($content_views[$view->id()]); + _acquia_cms_search_import_content_type_views($node_type); } } @@ -186,6 +192,20 @@ function _acquia_cms_search_import_content_type_views(NodeTypeInterface $node_ty } } +/** + * Implements hook_entity_insert(). + */ +function acquia_cms_search_entity_insert() { + // Normally, content is indexed immediately after it is created or modified, + // at the end of the current request. But that means content created + // programmatically (i.e., in the PHPUnit tests) are not being indexed. So, + // explicitly invoke the indexer whenever an entity is created. + $indexer = Drupal::service('search_api.post_request_indexing'); + if ($indexer instanceof DestructableInterface) { + $indexer->destruct(); + } +} + /** * Check if a configuration exists. * diff --git a/modules/acquia_cms_search/config/install/search_api.index.content.yml b/modules/acquia_cms_search/config/install/search_api.index.content.yml index ab47530fd..5ebcb0c52 100644 --- a/modules/acquia_cms_search/config/install/search_api.index.content.yml +++ b/modules/acquia_cms_search/config/install/search_api.index.content.yml @@ -10,7 +10,7 @@ dependencies: module: - acquia_cms_search third_party_settings: - acquia_cms_common: + acquia_cms_search: search_server: database id: content name: Content From 5bde896d38490c821f8d9fcbbfd876e7f1281c2c Mon Sep 17 00:00:00 2001 From: rajeshreeputra Date: Tue, 14 Jan 2025 14:29:57 +0530 Subject: [PATCH 10/18] ACMS-4403: Add event subscriber to import config from recipes. --- .../acquia_cms_search.services.yml | 8 + .../config/optional/views.view.articles.yml | 357 ----------------- .../config/optional/views.view.events.yml | 376 ------------------ .../config/optional/views.view.people.yml | 373 ----------------- .../config/optional/views.view.places.yml | 352 ---------------- .../config/optional/views.view.search.yml | 358 ----------------- .../EventSubscriber/RecipeConfigImporter.php | 150 +++++++ 7 files changed, 158 insertions(+), 1816 deletions(-) create mode 100644 modules/acquia_cms_search/acquia_cms_search.services.yml delete mode 100644 modules/acquia_cms_search/config/optional/views.view.articles.yml delete mode 100644 modules/acquia_cms_search/config/optional/views.view.events.yml delete mode 100644 modules/acquia_cms_search/config/optional/views.view.people.yml delete mode 100644 modules/acquia_cms_search/config/optional/views.view.places.yml delete mode 100644 modules/acquia_cms_search/config/optional/views.view.search.yml create mode 100644 modules/acquia_cms_search/src/EventSubscriber/RecipeConfigImporter.php diff --git a/modules/acquia_cms_search/acquia_cms_search.services.yml b/modules/acquia_cms_search/acquia_cms_search.services.yml new file mode 100644 index 000000000..ac432a237 --- /dev/null +++ b/modules/acquia_cms_search/acquia_cms_search.services.yml @@ -0,0 +1,8 @@ +services: + acquia_cms_search.recipe_config_importer: + class: Drupal\acquia_cms_search\EventSubscriber\RecipeConfigImporter + arguments: + - '@config.factory' + # - '@config.installer' + tags: + - { name: event_subscriber } diff --git a/modules/acquia_cms_search/config/optional/views.view.articles.yml b/modules/acquia_cms_search/config/optional/views.view.articles.yml deleted file mode 100644 index 777fea2d1..000000000 --- a/modules/acquia_cms_search/config/optional/views.view.articles.yml +++ /dev/null @@ -1,357 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.storage.node.field_article_type - - search_api.index.content - - views.view.articles_fallback - module: - - acquia_cms_search - - search_api - - user -id: articles -label: Articles -module: views -description: '' -tag: '' -base_table: search_api_index_content -base_field: search_api_id -display: - default: - id: default - display_title: Master - display_plugin: default - position: 0 - display_options: - title: Articles - fields: - field_article_type: - id: field_article_type - table: search_api_index_content - field: field_article_type - relationship: none - group_type: group - admin_label: '' - entity_type: null - entity_field: null - plugin_id: search_api_field - label: '' - exclude: false - alter: - alter_text: false - text: '' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: 0 - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: true - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: true - click_sort_column: target_id - type: entity_reference_label - settings: { } - group_column: target_id - group_columns: { } - group_rows: true - delta_limit: 0 - delta_offset: 0 - delta_reversed: false - delta_first_last: false - multi_type: separator - separator: ', ' - field_api_classes: false - field_rendering: true - fallback_handler: search_api_entity - fallback_options: - link_to_item: false - use_highlighting: false - multi_type: separator - multi_separator: ', ' - display_methods: { } - pager: - type: full - options: - offset: 0 - pagination_heading_level: h4 - items_per_page: 10 - total_pages: null - id: 0 - tags: - next: 'Next ›' - previous: '‹ Previous' - first: '« First' - last: 'Last »' - expose: - items_per_page: false - items_per_page_label: 'Items per page' - items_per_page_options: '5, 10, 25, 50' - items_per_page_options_all: false - items_per_page_options_all_label: '- All -' - offset: false - offset_label: Offset - quantity: 5 - exposed_form: - type: basic - options: - submit_button: Apply - reset_button: false - reset_button_label: Reset - exposed_sorts_label: 'Sort by' - expose_sort_order: true - sort_asc_label: Asc - sort_desc_label: Desc - access: - type: perm - options: - perm: 'access content' - cache: - type: search_api_tag - options: { } - empty: - view_fallback: - id: view_fallback - table: views - field: view_fallback - relationship: none - group_type: group - admin_label: '' - plugin_id: view_fallback - empty: true - view_to_insert: 'articles_fallback:default' - inherit_arguments: 0 - main_listing_pages_view: - id: main_listing_pages_view - table: views - field: main_listing_pages_view - relationship: none - group_type: group - admin_label: '' - plugin_id: main_listing_pages_view - empty: true - tokenize: 0 - content: - value: 'Sorry, no content found. Please try to search with different keywords.' - format: filtered_html - sorts: - created: - id: created - table: search_api_index_content - field: created - relationship: none - group_type: group - admin_label: '' - plugin_id: search_api - order: DESC - expose: - label: '' - field_identifier: created - exposed: false - arguments: { } - filters: - published: - id: published - table: search_api_index_content - field: published - relationship: none - group_type: group - admin_label: '' - plugin_id: search_api_boolean - operator: '=' - value: '1' - group: 1 - exposed: false - expose: - operator_id: '' - label: '' - description: '' - use_operator: false - operator: '' - operator_limit_selection: false - operator_list: { } - identifier: '' - required: false - remember: false - multiple: false - remember_roles: - authenticated: authenticated - is_grouped: false - group_info: - label: '' - description: '' - identifier: '' - optional: true - widget: select - multiple: false - remember: false - default_group: All - default_group_multiple: { } - group_items: { } - type: - id: type - table: search_api_index_content - field: type - relationship: none - group_type: group - admin_label: '' - plugin_id: search_api_options - operator: or - value: - article: article - group: 1 - exposed: false - expose: - operator_id: '' - label: '' - description: '' - use_operator: false - operator: '' - operator_limit_selection: false - operator_list: { } - identifier: '' - required: false - remember: false - multiple: false - remember_roles: - authenticated: authenticated - reduce: false - is_grouped: false - group_info: - label: '' - description: '' - identifier: '' - optional: true - widget: select - multiple: false - remember: false - default_group: All - default_group_multiple: { } - group_items: { } - reduce_duplicates: false - search_api_language: - id: search_api_language - table: search_api_index_content - field: search_api_language - relationship: none - group_type: group - admin_label: '' - plugin_id: search_api_language - operator: in - value: - '***LANGUAGE_language_interface***': '***LANGUAGE_language_interface***' - group: 1 - exposed: false - expose: - operator_id: '' - label: '' - description: '' - use_operator: false - operator: '' - operator_limit_selection: false - operator_list: { } - identifier: '' - required: false - remember: false - multiple: false - remember_roles: - authenticated: authenticated - reduce: false - is_grouped: false - group_info: - label: '' - description: '' - identifier: '' - optional: true - widget: select - multiple: false - remember: false - default_group: All - default_group_multiple: { } - group_items: { } - filter_groups: - operator: AND - groups: - 1: AND - style: - type: default - row: - type: search_api - query: - type: search_api_query - options: - bypass_access: false - skip_access: false - preserve_facet_query_args: false - relationships: { } - use_ajax: false - header: { } - footer: { } - display_extenders: { } - cache_metadata: - max-age: -1 - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url.path - - url.query_args - - 'user.node_grants:view' - - user.permissions - tags: - - 'config:field.storage.node.field_article_type' - - 'config:search_api.index.content' - - 'search_api_list:content' - page: - id: page - display_title: Page - display_plugin: page - position: 1 - display_options: - cache: - type: search_api_none - options: { } - defaults: - cache: false - exposed_block: true - display_extenders: { } - path: articles - cache_metadata: - max-age: -1 - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url.path - - url.query_args - - 'user.node_grants:view' - - user.permissions - tags: - - 'config:field.storage.node.field_article_type' - - 'config:search_api.index.content' - - 'search_api_list:content' diff --git a/modules/acquia_cms_search/config/optional/views.view.events.yml b/modules/acquia_cms_search/config/optional/views.view.events.yml deleted file mode 100644 index 2a06b3e23..000000000 --- a/modules/acquia_cms_search/config/optional/views.view.events.yml +++ /dev/null @@ -1,376 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.storage.node.field_event_type - - search_api.index.content - - views.view.events_fallback - module: - - acquia_cms_search - - search_api - - user -id: events -label: Events -module: views -description: '' -tag: '' -base_table: search_api_index_content -base_field: search_api_id -display: - default: - id: default - display_title: Master - display_plugin: default - position: 0 - display_options: - title: Events - fields: - field_event_type: - id: field_event_type - table: search_api_index_content - field: field_event_type - relationship: none - group_type: group - admin_label: '' - plugin_id: search_api_field - label: '' - exclude: false - alter: - alter_text: false - text: '' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: 0 - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: false - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: true - click_sort_column: target_id - type: entity_reference_label - settings: - link: true - group_column: target_id - group_columns: { } - group_rows: true - delta_limit: 0 - delta_offset: 0 - delta_reversed: false - delta_first_last: false - multi_type: separator - separator: ', ' - field_api_classes: false - field_rendering: true - fallback_handler: search_api_entity - fallback_options: - link_to_item: false - use_highlighting: false - multi_type: separator - multi_separator: ', ' - display_methods: - article_type: - display_method: label - categories: - display_method: label - event_type: - display_method: label - person_type: - display_method: label - place_type: - display_method: label - tags: - display_method: label - pager: - type: full - options: - offset: 0 - pagination_heading_level: h4 - items_per_page: 10 - total_pages: null - id: 0 - tags: - next: 'Next ›' - previous: '‹ Previous' - first: '« First' - last: 'Last »' - expose: - items_per_page: false - items_per_page_label: 'Items per page' - items_per_page_options: '5, 10, 25, 50' - items_per_page_options_all: false - items_per_page_options_all_label: '- All -' - offset: false - offset_label: Offset - quantity: 5 - exposed_form: - type: basic - options: - submit_button: Apply - reset_button: false - reset_button_label: Reset - exposed_sorts_label: 'Sort by' - expose_sort_order: true - sort_asc_label: Asc - sort_desc_label: Desc - access: - type: perm - options: - perm: 'access content' - cache: - type: search_api_tag - options: { } - empty: - view_fallback: - id: view_fallback - table: views - field: view_fallback - relationship: none - group_type: group - admin_label: '' - plugin_id: view_fallback - empty: true - view_to_insert: 'events_fallback:default' - inherit_arguments: 0 - main_listing_pages_view: - id: main_listing_pages_view - table: views - field: main_listing_pages_view - relationship: none - group_type: group - admin_label: '' - plugin_id: main_listing_pages_view - empty: true - tokenize: 0 - content: - value: 'Sorry, no content found. Please try to search with different keywords.' - format: filtered_html - sorts: - field_event_start: - id: field_event_start - table: search_api_index_content - field: field_event_start - relationship: none - group_type: group - admin_label: '' - plugin_id: search_api - order: ASC - expose: - label: '' - field_identifier: field_event_start - exposed: false - title: - id: title - table: search_api_index_content - field: title - relationship: none - group_type: group - admin_label: '' - plugin_id: search_api - order: ASC - expose: - label: '' - field_identifier: title - exposed: false - arguments: { } - filters: - type: - id: type - table: search_api_index_content - field: type - relationship: none - group_type: group - admin_label: '' - plugin_id: search_api_options - operator: or - value: - event: event - group: 1 - exposed: false - expose: - operator_id: '' - label: '' - description: '' - use_operator: false - operator: '' - operator_limit_selection: false - operator_list: { } - identifier: '' - required: false - remember: false - multiple: false - remember_roles: - authenticated: authenticated - reduce: false - is_grouped: false - group_info: - label: '' - description: '' - identifier: '' - optional: true - widget: select - multiple: false - remember: false - default_group: All - default_group_multiple: { } - group_items: { } - reduce_duplicates: false - published: - id: published - table: search_api_index_content - field: published - relationship: none - group_type: group - admin_label: '' - plugin_id: search_api_boolean - operator: '=' - value: '1' - group: 1 - exposed: false - expose: - operator_id: '' - label: '' - description: '' - use_operator: false - operator: '' - operator_limit_selection: false - operator_list: { } - identifier: '' - required: false - remember: false - multiple: false - remember_roles: - authenticated: authenticated - is_grouped: false - group_info: - label: '' - description: '' - identifier: '' - optional: true - widget: select - multiple: false - remember: false - default_group: All - default_group_multiple: { } - group_items: { } - search_api_language: - id: search_api_language - table: search_api_index_content - field: search_api_language - relationship: none - group_type: group - admin_label: '' - plugin_id: search_api_language - operator: in - value: - '***LANGUAGE_language_interface***': '***LANGUAGE_language_interface***' - group: 1 - exposed: false - expose: - operator_id: '' - label: '' - description: '' - use_operator: false - operator: '' - operator_limit_selection: false - operator_list: { } - identifier: '' - required: false - remember: false - multiple: false - remember_roles: - authenticated: authenticated - reduce: false - is_grouped: false - group_info: - label: '' - description: '' - identifier: '' - optional: true - widget: select - multiple: false - remember: false - default_group: All - default_group_multiple: { } - group_items: { } - style: - type: default - row: - type: search_api - query: - type: search_api_query - options: - bypass_access: false - skip_access: false - preserve_facet_query_args: false - relationships: { } - header: { } - footer: { } - display_extenders: { } - cache_metadata: - max-age: -1 - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url.path - - url.query_args - - 'user.node_grants:view' - - user.permissions - tags: - - 'config:field.storage.node.field_event_type' - - 'config:search_api.index.content' - - 'search_api_list:content' - page: - id: page - display_title: Page - display_plugin: page - position: 1 - display_options: - cache: - type: search_api_none - options: { } - defaults: - cache: false - exposed_block: true - display_extenders: { } - path: events - cache_metadata: - max-age: -1 - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url.path - - url.query_args - - 'user.node_grants:view' - - user.permissions - tags: - - 'config:field.storage.node.field_event_type' - - 'config:search_api.index.content' - - 'search_api_list:content' diff --git a/modules/acquia_cms_search/config/optional/views.view.people.yml b/modules/acquia_cms_search/config/optional/views.view.people.yml deleted file mode 100644 index d933c7edc..000000000 --- a/modules/acquia_cms_search/config/optional/views.view.people.yml +++ /dev/null @@ -1,373 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.storage.node.field_person_type - - search_api.index.content - - views.view.people_fallback - module: - - acquia_cms_search - - search_api - - user -id: people -label: People -module: views -description: '' -tag: '' -base_table: search_api_index_content -base_field: search_api_id -display: - default: - id: default - display_title: Master - display_plugin: default - position: 0 - display_options: - title: People - fields: - field_person_type: - id: field_person_type - table: search_api_index_content - field: field_person_type - relationship: none - group_type: group - admin_label: '' - plugin_id: search_api_field - label: '' - exclude: false - alter: - alter_text: false - text: '' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: 0 - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: false - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: true - click_sort_column: target_id - type: entity_reference_label - settings: - link: true - group_column: target_id - group_columns: { } - group_rows: true - delta_limit: 0 - delta_offset: 0 - delta_reversed: false - delta_first_last: false - multi_type: separator - separator: ', ' - field_api_classes: false - field_rendering: true - fallback_handler: search_api_entity - fallback_options: - link_to_item: false - use_highlighting: false - multi_type: separator - multi_separator: ', ' - display_methods: - article_type: - display_method: label - categories: - display_method: label - event_type: - display_method: label - person_type: - display_method: label - place_type: - display_method: label - tags: - display_method: label - pager: - type: full - options: - offset: 0 - pagination_heading_level: h4 - items_per_page: 9 - total_pages: null - id: 0 - tags: - next: 'Next ›' - previous: '‹ Previous' - first: '« First' - last: 'Last »' - expose: - items_per_page: false - items_per_page_label: 'Items per page' - items_per_page_options: '5, 10, 25, 50' - items_per_page_options_all: false - items_per_page_options_all_label: '- All -' - offset: false - offset_label: Offset - quantity: 5 - exposed_form: - type: basic - options: - submit_button: Apply - reset_button: false - reset_button_label: Reset - exposed_sorts_label: 'Sort by' - expose_sort_order: true - sort_asc_label: Asc - sort_desc_label: Desc - access: - type: perm - options: - perm: 'access content' - cache: - type: search_api_tag - options: { } - empty: - view_fallback: - id: view_fallback - table: views - field: view_fallback - relationship: none - group_type: group - admin_label: '' - plugin_id: view_fallback - empty: true - view_to_insert: 'people_fallback:default' - inherit_arguments: 0 - main_listing_pages_view: - id: main_listing_pages_view - table: views - field: main_listing_pages_view - relationship: none - group_type: group - admin_label: '' - plugin_id: main_listing_pages_view - empty: true - tokenize: 0 - content: - value: 'Sorry, no content found. Please try to search with different keywords.' - format: filtered_html - sorts: - title: - id: title - table: search_api_index_content - field: title - relationship: none - group_type: group - admin_label: '' - plugin_id: search_api - order: ASC - expose: - label: '' - field_identifier: title - exposed: false - arguments: { } - filters: - type: - id: type - table: search_api_index_content - field: type - relationship: none - group_type: group - admin_label: '' - plugin_id: search_api_options - operator: or - value: - person: person - group: 1 - exposed: false - expose: - operator_id: '' - label: '' - description: '' - use_operator: false - operator: '' - operator_limit_selection: false - operator_list: { } - identifier: '' - required: false - remember: false - multiple: false - remember_roles: - authenticated: authenticated - reduce: false - is_grouped: false - group_info: - label: '' - description: '' - identifier: '' - optional: true - widget: select - multiple: false - remember: false - default_group: All - default_group_multiple: { } - group_items: { } - reduce_duplicates: false - published: - id: published - table: search_api_index_content - field: published - relationship: none - group_type: group - admin_label: '' - plugin_id: search_api_boolean - operator: '=' - value: '1' - group: 1 - exposed: false - expose: - operator_id: '' - label: '' - description: '' - use_operator: false - operator: '' - operator_limit_selection: false - operator_list: { } - identifier: '' - required: false - remember: false - multiple: false - remember_roles: - authenticated: authenticated - is_grouped: false - group_info: - label: '' - description: '' - identifier: '' - optional: true - widget: select - multiple: false - remember: false - default_group: All - default_group_multiple: { } - group_items: { } - search_api_language: - id: search_api_language - table: search_api_index_content - field: search_api_language - relationship: none - group_type: group - admin_label: '' - plugin_id: search_api_language - operator: in - value: - '***LANGUAGE_language_interface***': '***LANGUAGE_language_interface***' - group: 1 - exposed: false - expose: - operator_id: '' - label: '' - description: '' - use_operator: false - operator: '' - operator_limit_selection: false - operator_list: { } - identifier: '' - required: false - remember: false - multiple: false - remember_roles: - authenticated: authenticated - reduce: false - is_grouped: false - group_info: - label: '' - description: '' - identifier: '' - optional: true - widget: select - multiple: false - remember: false - default_group: All - default_group_multiple: { } - group_items: { } - style: - type: default - row: - type: search_api - options: - view_modes: - 'entity:node': - article: default - event: default - page: default - person: card - place: default - query: - type: search_api_query - options: - bypass_access: false - skip_access: false - preserve_facet_query_args: false - relationships: { } - header: { } - footer: { } - display_extenders: { } - cache_metadata: - max-age: -1 - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url.path - - url.query_args - - 'user.node_grants:view' - - user.permissions - tags: - - 'config:field.storage.node.field_person_type' - - 'config:search_api.index.content' - - 'search_api_list:content' - page: - id: page - display_title: Page - display_plugin: page - position: 1 - display_options: - cache: - type: search_api_tag - options: { } - defaults: - cache: false - exposed_block: true - display_extenders: { } - path: people - cache_metadata: - max-age: 0 - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url.path - - url.query_args - - 'user.node_grants:view' - - user.permissions - tags: - - 'config:facets.facet.people_category' - - 'config:facets.facet.people_person_type' - - 'config:field.storage.node.field_person_type' - - 'config:search_api.index.content' - - 'search_api_list:content' diff --git a/modules/acquia_cms_search/config/optional/views.view.places.yml b/modules/acquia_cms_search/config/optional/views.view.places.yml deleted file mode 100644 index 90224926b..000000000 --- a/modules/acquia_cms_search/config/optional/views.view.places.yml +++ /dev/null @@ -1,352 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - field.storage.node.field_place_type - - search_api.index.content - - views.view.places_fallback - module: - - acquia_cms_search - - search_api - - user -id: places -label: Places -module: views -description: '' -tag: '' -base_table: search_api_index_content -base_field: search_api_id -display: - default: - id: default - display_title: Master - display_plugin: default - position: 0 - display_options: - title: Places - fields: - field_place_type: - id: field_place_type - table: search_api_index_content - field: field_place_type - relationship: none - group_type: group - admin_label: '' - entity_type: null - entity_field: null - plugin_id: search_api_field - label: '' - exclude: false - alter: - alter_text: false - text: '' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: 0 - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: true - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: true - click_sort_column: target_id - type: entity_reference_label - settings: { } - group_column: target_id - group_columns: { } - group_rows: true - delta_limit: 0 - delta_offset: 0 - delta_reversed: false - delta_first_last: false - multi_type: separator - separator: ', ' - field_api_classes: false - field_rendering: true - fallback_handler: search_api_entity - fallback_options: - link_to_item: false - use_highlighting: false - multi_type: separator - multi_separator: ', ' - display_methods: { } - pager: - type: full - options: - offset: 0 - pagination_heading_level: h4 - items_per_page: 10 - total_pages: null - id: 0 - tags: - next: 'Next ›' - previous: '‹ Previous' - first: '« First' - last: 'Last »' - expose: - items_per_page: false - items_per_page_label: 'Items per page' - items_per_page_options: '5, 10, 25, 50' - items_per_page_options_all: false - items_per_page_options_all_label: '- All -' - offset: false - offset_label: Offset - quantity: 5 - exposed_form: - type: basic - options: - submit_button: Apply - reset_button: false - reset_button_label: Reset - exposed_sorts_label: 'Sort by' - expose_sort_order: true - sort_asc_label: Asc - sort_desc_label: Desc - access: - type: perm - options: - perm: 'access content' - cache: - type: search_api_tag - options: { } - empty: - view_fallback: - id: view_fallback - table: views - field: view_fallback - relationship: none - group_type: group - admin_label: '' - plugin_id: view_fallback - empty: true - view_to_insert: 'places_fallback:default' - inherit_arguments: 0 - main_listing_pages_view: - id: main_listing_pages_view - table: views - field: main_listing_pages_view - relationship: none - group_type: group - admin_label: '' - plugin_id: main_listing_pages_view - empty: true - tokenize: 0 - content: - value: 'Sorry, no content found. Please try to search with different keywords.' - format: filtered_html - sorts: - title: - id: title - table: search_api_index_content - field: title - relationship: none - group_type: group - admin_label: '' - plugin_id: search_api - order: ASC - expose: - label: '' - field_identifier: title - exposed: false - arguments: { } - filters: - type: - id: type - table: search_api_index_content - field: type - relationship: none - group_type: group - admin_label: '' - plugin_id: search_api_options - operator: or - value: - place: place - group: 1 - exposed: false - expose: - operator_id: '' - label: '' - description: '' - use_operator: false - operator: '' - operator_limit_selection: false - operator_list: { } - identifier: '' - required: false - remember: false - multiple: false - remember_roles: - authenticated: authenticated - reduce: false - is_grouped: false - group_info: - label: '' - description: '' - identifier: '' - optional: true - widget: select - multiple: false - remember: false - default_group: All - default_group_multiple: { } - group_items: { } - reduce_duplicates: false - published: - id: published - table: search_api_index_content - field: published - relationship: none - group_type: group - admin_label: '' - plugin_id: search_api_boolean - operator: '=' - value: '1' - group: 1 - exposed: false - expose: - operator_id: '' - label: '' - description: '' - use_operator: false - operator: '' - operator_limit_selection: false - operator_list: { } - identifier: '' - required: false - remember: false - multiple: false - remember_roles: - authenticated: authenticated - is_grouped: false - group_info: - label: '' - description: '' - identifier: '' - optional: true - widget: select - multiple: false - remember: false - default_group: All - default_group_multiple: { } - group_items: { } - search_api_language: - id: search_api_language - table: search_api_index_content - field: search_api_language - relationship: none - group_type: group - admin_label: '' - plugin_id: search_api_language - operator: in - value: - '***LANGUAGE_language_interface***': '***LANGUAGE_language_interface***' - group: 1 - exposed: false - expose: - operator_id: '' - label: '' - description: '' - use_operator: false - operator: '' - operator_limit_selection: false - operator_list: { } - identifier: '' - required: false - remember: false - multiple: false - remember_roles: - authenticated: authenticated - reduce: false - is_grouped: false - group_info: - label: '' - description: '' - identifier: '' - optional: true - widget: select - multiple: false - remember: false - default_group: All - default_group_multiple: { } - group_items: { } - style: - type: default - row: - type: search_api - query: - type: search_api_query - options: - bypass_access: false - skip_access: false - preserve_facet_query_args: false - relationships: { } - header: { } - footer: { } - display_extenders: { } - cache_metadata: - max-age: -1 - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url.path - - url.query_args - - 'user.node_grants:view' - - user.permissions - tags: - - 'config:field.storage.node.field_place_type' - - 'config:search_api.index.content' - - 'search_api_list:content' - page: - id: page - display_title: Page - display_plugin: page - position: 1 - display_options: - cache: - type: search_api_none - options: { } - defaults: - cache: false - exposed_block: true - display_extenders: { } - path: places - cache_metadata: - max-age: -1 - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url.path - - url.query_args - - 'user.node_grants:view' - - user.permissions - tags: - - 'config:field.storage.node.field_place_type' - - 'config:search_api.index.content' - - 'search_api_list:content' diff --git a/modules/acquia_cms_search/config/optional/views.view.search.yml b/modules/acquia_cms_search/config/optional/views.view.search.yml deleted file mode 100644 index b8654a8a1..000000000 --- a/modules/acquia_cms_search/config/optional/views.view.search.yml +++ /dev/null @@ -1,358 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - search_api.index.content - - views.view.search_fallback - module: - - search_api - - user -id: search -label: Search -module: views -description: '' -tag: '' -base_table: search_api_index_content -base_field: search_api_id -display: - default: - id: default - display_title: Master - display_plugin: default - position: 0 - display_options: - title: Search - fields: - rendered_item: - id: rendered_item - table: search_api_index_content - field: rendered_item - relationship: none - group_type: group - admin_label: '' - plugin_id: search_api - label: '' - exclude: false - alter: - alter_text: false - text: '' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: 0 - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: false - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: true - link_to_item: false - use_highlighting: false - multi_type: separator - multi_separator: ', ' - pager: - type: full - options: - offset: 0 - pagination_heading_level: h4 - items_per_page: 10 - total_pages: null - id: 0 - tags: - next: 'Next ›' - previous: '‹ Previous' - first: '« First' - last: 'Last »' - expose: - items_per_page: false - items_per_page_label: 'Items per page' - items_per_page_options: '5, 10, 25, 50' - items_per_page_options_all: false - items_per_page_options_all_label: '- All -' - offset: false - offset_label: Offset - quantity: 3 - exposed_form: - type: basic - options: - submit_button: Search - reset_button: false - reset_button_label: Reset - exposed_sorts_label: 'Sort by' - expose_sort_order: true - sort_asc_label: Asc - sort_desc_label: Desc - access: - type: perm - options: - perm: 'access content' - cache: - type: search_api_tag - options: { } - empty: - view_fallback: - id: view_fallback - table: views - field: view_fallback - relationship: none - group_type: group - admin_label: '' - plugin_id: view_fallback - empty: true - view_to_insert: 'search_fallback:search_fallback_block' - inherit_arguments: 0 - main_listing_pages_view: - id: main_listing_pages_view - table: views - field: main_listing_pages_view - relationship: none - group_type: group - admin_label: '' - plugin_id: main_listing_pages_view - empty: true - tokenize: 0 - content: - value: 'Sorry, no content found. Please try to search with different keywords.' - format: filtered_html - sorts: - search_api_relevance: - id: search_api_relevance - table: search_api_index_content - field: search_api_relevance - relationship: none - group_type: group - admin_label: '' - plugin_id: search_api - order: DESC - expose: - label: '' - field_identifier: search_api_relevance - exposed: false - arguments: { } - filters: - search_api_fulltext: - id: search_api_fulltext - table: search_api_index_content - field: search_api_fulltext - relationship: none - group_type: group - admin_label: '' - plugin_id: search_api_fulltext - operator: or - value: '' - group: 1 - exposed: true - expose: - operator_id: search_api_fulltext_op - label: '' - description: '' - use_operator: false - operator: search_api_fulltext_op - operator_limit_selection: false - operator_list: { } - identifier: keywords - required: false - remember: false - multiple: false - remember_roles: - authenticated: authenticated - administrator: '0' - developer: '0' - site_builder: '0' - content_administrator: '0' - content_author: '0' - content_editor: '0' - user_administrator: '0' - anonymous: '0' - placeholder: '' - is_grouped: false - group_info: - label: '' - description: '' - identifier: '' - optional: true - widget: select - multiple: false - remember: false - default_group: All - default_group_multiple: { } - group_items: { } - parse_mode: terms - min_length: null - fields: { } - published: - id: published - table: search_api_index_content - field: published - relationship: none - group_type: group - admin_label: '' - plugin_id: search_api_boolean - operator: '=' - value: '1' - group: 1 - exposed: false - expose: - operator_id: '' - label: '' - description: '' - use_operator: false - operator: '' - operator_limit_selection: false - operator_list: { } - identifier: '' - required: false - remember: false - multiple: false - remember_roles: - authenticated: authenticated - is_grouped: false - group_info: - label: '' - description: '' - identifier: '' - optional: true - widget: select - multiple: false - remember: false - default_group: All - default_group_multiple: { } - group_items: { } - search_api_language: - id: search_api_language - table: search_api_index_content - field: search_api_language - relationship: none - group_type: group - admin_label: '' - plugin_id: search_api_language - operator: in - value: - '***LANGUAGE_language_interface***': '***LANGUAGE_language_interface***' - group: 1 - exposed: false - expose: - operator_id: '' - label: '' - description: '' - use_operator: false - operator: '' - operator_limit_selection: false - operator_list: { } - identifier: '' - required: false - remember: false - multiple: false - remember_roles: - authenticated: authenticated - reduce: false - is_grouped: false - group_info: - label: '' - description: '' - identifier: '' - optional: true - widget: select - multiple: false - remember: false - default_group: All - default_group_multiple: { } - group_items: { } - style: - type: default - row: - type: search_api - options: - view_modes: - 'entity:node': - article: teaser - event: teaser - page: teaser - person: teaser - place: teaser - query: - type: search_api_query - options: - bypass_access: false - skip_access: false - preserve_facet_query_args: false - relationships: { } - header: - result: - id: result - table: views - field: result - relationship: none - group_type: group - admin_label: '' - plugin_id: result - empty: false - content: '@end of @total results' - footer: { } - display_extenders: { } - cache_metadata: - max-age: -1 - contexts: - - 'languages:language_interface' - - url - - url.path - - url.query_args - - 'user.node_grants:view' - - user.permissions - tags: - - 'config:search_api.index.content' - - 'search_api_list:content' - search: - id: search - display_title: Page - display_plugin: page - position: 1 - display_options: - cache: - type: search_api_tag - options: { } - defaults: - cache: false - exposed_block: true - display_extenders: { } - path: search - cache_metadata: - max-age: 0 - contexts: - - 'languages:language_interface' - - url - - url.path - - url.query_args - - 'user.node_grants:view' - - user.permissions - tags: - - 'config:facets.facet.search_content_type' - - 'config:search_api.index.content' - - 'config:views.view.search' - - 'search_api_list:content' diff --git a/modules/acquia_cms_search/src/EventSubscriber/RecipeConfigImporter.php b/modules/acquia_cms_search/src/EventSubscriber/RecipeConfigImporter.php new file mode 100644 index 000000000..622ba179c --- /dev/null +++ b/modules/acquia_cms_search/src/EventSubscriber/RecipeConfigImporter.php @@ -0,0 +1,150 @@ +configFactory = $config_factory; + // $this->configInstaller = $config_installer; + } + + /** + * {@inheritdoc} + */ + public static function getSubscribedEvents(): array { + return [ + RecipeAppliedEvent::class => 'onRecipeApply', + ]; + } + + /** + * Import the search related config from related recipe. + * + * @param \Drupal\Core\Recipe\RecipeAppliedEvent $event + * The recipe applied event. + */ + public function onRecipeApply(RecipeAppliedEvent $event): void { + $recipe_name = $this->getRecipeName($event->recipe->path); + if ($recipe_name == 'acquia_starterkit_search') { + // $this->configInstaller->installOptionalConfig(NULL, ['module' => 'acquia_cms_search']); + \Drupal::service('config.installer')->installOptionalConfig(NULL, [ + 'module' => 'acquia_cms_search' + ]); + $this->importSearchConfig(); + } + elseif (str_starts_with($recipe_name, 'acquia_starterkit_')) { + $this->importConfigFromRecipe($event->recipe->path); + } + } + + /** + * Extracts the recipe name from the given path. + * + * @param string $path + * The path to the recipe. + * + * @return string + * The extracted recipe name. + */ + private function getRecipeName(string $path): string { + $exploded = explode('/', $path); + return end($exploded); + } + + /** + * Imports search configuration if it exists. + */ + private function importSearchConfig(): void { + $recipes = $this->configFactory->get('acquia_starterkit_core.settings')->get('recipes_applied') ?? []; + foreach ($recipes as $recipe) { + $recipe_path = $this->getRecipePathByName($recipe); + $this->importConfigFromRecipe($recipe_path . '/' . $recipe); + } + } + + /** + * Imports configuration from the specified recipe path. + * + * @param string $recipe_path + * The path to the recipe. + */ + private function importConfigFromRecipe(string $recipe_path): void { + $search_config_path = $recipe_path . '/search'; + $search_config_path_install = $recipe_path . '/search/install'; + $this->importConfigFromPath($search_config_path_install); + $current_theme = $this->configFactory->get('system.theme')->get('default'); + $search_config_path_current_theme = $search_config_path . '/' . $current_theme; + $this->importConfigFromPath($search_config_path_current_theme); + } + + /** + * Imports configuration from the specified path. + * + * @param string $config_path + * The path to the recipe. + */ + private function importConfigFromPath(string $config_path): void { + $config_source = new FileStorage($config_path); + // $this->configInstaller->installOptionalConfig($config_source); + \Drupal::service('config.installer')->installOptionalConfig($config_source); + } + + /** + * Gets the path to the recipe by its name. + * + * @param string $recipe_name + * The name of the recipe. + * + * @return string|null + * The path to the recipe, or null if not found. + */ + private function getRecipePathByName(string $recipe_name): ?string { + $finder = new Finder(); + $finder->directories()->in(DRUPAL_ROOT)->name($recipe_name); + + foreach ($finder as $file) { + return $file->getPath(); + } + + return NULL; + } + +} From dabf6635598db74805a8e0988f48b1ecad281f8a Mon Sep 17 00:00:00 2001 From: rajeshreeputra Date: Tue, 14 Jan 2025 14:42:53 +0530 Subject: [PATCH 11/18] ACMS-4403: Remove unused content type related search view import logic. --- .../acquia_cms_search.install | 1 - .../acquia_cms_search.module | 90 ------------------- 2 files changed, 91 deletions(-) diff --git a/modules/acquia_cms_search/acquia_cms_search.install b/modules/acquia_cms_search/acquia_cms_search.install index 3b1a07bea..f6c0297e6 100644 --- a/modules/acquia_cms_search/acquia_cms_search.install +++ b/modules/acquia_cms_search/acquia_cms_search.install @@ -27,7 +27,6 @@ function acquia_cms_search_install($is_syncing) { $entity_type_manager = \Drupal::entityTypeManager(); $node_types = $entity_type_manager->getStorage('node_type')->loadMultiple(); array_walk($node_types, 'acquia_cms_search_node_type_insert'); - array_walk($node_types, '_acquia_cms_search_import_content_type_views'); $search_category = $entity_type_manager->getStorage('facets_facet')->loadByProperties(['id' => 'search_category']); if (!$search_category) { _acquia_cms_search_add_category_facet(); diff --git a/modules/acquia_cms_search/acquia_cms_search.module b/modules/acquia_cms_search/acquia_cms_search.module index 877004cd4..5c1105136 100644 --- a/modules/acquia_cms_search/acquia_cms_search.module +++ b/modules/acquia_cms_search/acquia_cms_search.module @@ -10,14 +10,11 @@ use Drupal\acquia_cms_search\Facade\FacetFacade; use Drupal\acquia_cms_search\Facade\SearchFacade; use Drupal\acquia_cms_search\Plugin\views\query\SearchApiQuery; use Drupal\acquia_search\Helper\Runtime; -use Drupal\Core\Config\FileStorage; use Drupal\Core\DestructableInterface; use Drupal\field\FieldConfigInterface; use Drupal\node\NodeTypeInterface; use Drupal\search_api\Entity\Index; use Drupal\search_api\ServerInterface; -use Drupal\views\Entity\View; -use Drupal\views\ViewEntityInterface; /** * Implements hook_views_data(). @@ -78,7 +75,6 @@ function acquia_cms_search_node_type_insert(NodeTypeInterface $node_type) { if (!$node_type->isSyncing()) { _acquia_cms_search_add_category_facet(); } - _acquia_cms_search_import_content_type_views($node_type); } /** @@ -89,7 +85,6 @@ function acquia_cms_search_node_type_update(NodeTypeInterface $node_type) { if (!$node_type->isSyncing()) { _acquia_cms_search_add_category_facet(); } - _acquia_cms_search_import_content_type_views($node_type); } /** @@ -119,77 +114,6 @@ function acquia_cms_search_field_config_insert(FieldConfigInterface $field_confi if (in_array($field_storage->getType(), $allowed_fields_type)) { Drupal::classResolver(SearchFacade::class)->addFields($field_storage); } - - // Insert view on config import. - $configs = [ - 'node.article.field_article_type' => 'article', - 'node.event.field_event_type' => 'event', - 'node.person.field_person_type' => 'person', - 'node.place.field_place_type' => 'place', - ]; - if (in_array($field_config->id(), array_keys($configs))) { - _acquia_cms_search_import_content_type_views(\Drupal::entityTypeManager()->getStorage('node_type')->load($configs[$field_config->id()])); - } -} - -/** - * Implements hook_ENTITY_TYPE_insert() for node types. - */ -function acquia_cms_search_view_insert(ViewEntityInterface $view) { - $content_views = [ - 'articles_fallback' => 'article', - 'events_fallback' => 'event', - 'people_fallback' => 'person', - 'places_fallback' => 'place', - ]; - if(!in_array($view->id(), array_keys($content_views))) { - return; - } - if (!$view->isSyncing()) { - $node_type = \Drupal::entityTypeManager()->getStorage('node_type')->load($content_views[$view->id()]); - _acquia_cms_search_import_content_type_views($node_type); - } -} - -/** - * Import views for content types. - */ -function _acquia_cms_search_import_content_type_views(NodeTypeInterface $node_type){ - $content_views = [ - 'article' => 'articles', - 'event' => 'events', - 'person' => 'people', - 'place' => 'places', - ]; - if(!in_array($node_type->id(), array_keys($content_views))) { - return; - } - // Load the view. - $view = View::load($content_views[$node_type->id()]); - if (!$view) { - // import the view. - $source = new FileStorage(__DIR__ . '/config/optional'); - $entity_storage = \Drupal::entityTypeManager()->getStorage('view'); - $view_config = $source->read('views.view.' . $content_views[$node_type->id()]); - // Validate dependencies exist. - if (!empty($view_config['dependencies'])) { - $module_handler = \Drupal::service('module_handler'); - foreach ($view_config['dependencies']['module'] as $dependency) { - if (!$module_handler->moduleExists($dependency)) { - return; - } - } - foreach ($view_config['dependencies']['config'] as $dependency) { - if (!configExists($dependency)) { - return; - } - } - } - - // Create the view entity. - $entity = $entity_storage->createFromStorageRecord($view_config); - $entity->save(); - } } /** @@ -206,20 +130,6 @@ function acquia_cms_search_entity_insert() { } } -/** - * Check if a configuration exists. - * - * @param string $config_name - * The name of the configuration to check. - * - * @return bool - * TRUE if the configuration exists, FALSE otherwise. - */ -function configExists($config_name) { - $config_factory = \Drupal::service('config.factory'); - return $config_factory->get($config_name)->isNew() === FALSE; -} - /** * Implements hook_ENTITY_TYPE_insert() for Search API servers. */ From b955a17339cd7c852e46abfbe1bc5322e831292d Mon Sep 17 00:00:00 2001 From: rajeshreeputra Date: Tue, 14 Jan 2025 16:03:53 +0530 Subject: [PATCH 12/18] ACMS-4403: Revert the block config updated as per olivero theme. --- .../optional/block.block.clear_facet_filters.yml | 12 +++++++----- .../optional/block.block.exposed_form_search.yml | 12 +++++++----- .../config/optional/block.block.search_category.yml | 12 +++++++----- .../optional/block.block.search_content_type.yml | 12 +++++++----- 4 files changed, 28 insertions(+), 20 deletions(-) diff --git a/modules/acquia_cms_search/config/optional/block.block.clear_facet_filters.yml b/modules/acquia_cms_search/config/optional/block.block.clear_facet_filters.yml index 87f3ab9fb..7d9f4c960 100644 --- a/modules/acquia_cms_search/config/optional/block.block.clear_facet_filters.yml +++ b/modules/acquia_cms_search/config/optional/block.block.clear_facet_filters.yml @@ -4,9 +4,11 @@ dependencies: module: - acquia_cms_search - collapsiblock + theme: + - cohesion_theme id: clear_facet_filters -theme: olivero -region: sidebar +theme: cohesion_theme +region: dx8_hidden weight: 0 provider: null plugin: clear_facet_filters @@ -16,7 +18,7 @@ settings: label_display: '0' provider: acquia_cms_search visibility: - request_path: - id: request_path + cohesion_master_template: + id: cohesion_master_template negate: false - pages: "/articles\r\n/events\r\n/places\r\n/people" + using_master_template: 0 diff --git a/modules/acquia_cms_search/config/optional/block.block.exposed_form_search.yml b/modules/acquia_cms_search/config/optional/block.block.exposed_form_search.yml index d7bc3b847..64c038119 100644 --- a/modules/acquia_cms_search/config/optional/block.block.exposed_form_search.yml +++ b/modules/acquia_cms_search/config/optional/block.block.exposed_form_search.yml @@ -5,9 +5,11 @@ dependencies: - views.view.search module: - views + theme: + - cohesion_theme id: exposed_form_search -theme: olivero -region: sidebar +theme: cohesion_theme +region: dx8_hidden weight: 0 provider: null plugin: 'views_exposed_filter_block:search-search' @@ -18,7 +20,7 @@ settings: provider: views views_label: '' visibility: - request_path: - id: request_path + cohesion_master_template: + id: cohesion_master_template negate: false - pages: "/search" + using_master_template: 0 diff --git a/modules/acquia_cms_search/config/optional/block.block.search_category.yml b/modules/acquia_cms_search/config/optional/block.block.search_category.yml index 7d9d46b3e..a3047b0ea 100644 --- a/modules/acquia_cms_search/config/optional/block.block.search_category.yml +++ b/modules/acquia_cms_search/config/optional/block.block.search_category.yml @@ -6,12 +6,14 @@ dependencies: module: - collapsiblock - facets + theme: + - cohesion_theme third_party_settings: collapsiblock: collapse_action: 2 id: search_category -theme: olivero -region: sidebar +theme: cohesion_theme +region: dx8_hidden weight: 0 provider: null plugin: 'facet_block:search_category' @@ -22,7 +24,7 @@ settings: provider: facets block_id: search_category visibility: - request_path: - id: request_path + cohesion_master_template: + id: cohesion_master_template negate: false - pages: "/search" + using_master_template: 0 diff --git a/modules/acquia_cms_search/config/optional/block.block.search_content_type.yml b/modules/acquia_cms_search/config/optional/block.block.search_content_type.yml index b0a84d10f..968182f7f 100644 --- a/modules/acquia_cms_search/config/optional/block.block.search_content_type.yml +++ b/modules/acquia_cms_search/config/optional/block.block.search_content_type.yml @@ -6,12 +6,14 @@ dependencies: module: - collapsiblock - facets + theme: + - cohesion_theme third_party_settings: collapsiblock: collapse_action: 2 id: search_content_type -theme: olivero -region: sidebar +theme: cohesion_theme +region: dx8_hidden weight: 0 provider: null plugin: 'facet_block:search_content_type' @@ -22,7 +24,7 @@ settings: provider: facets block_id: search_content_type visibility: - request_path: - id: request_path + cohesion_master_template: + id: cohesion_master_template negate: false - pages: "/search" + using_master_template: 0 From 4fcc2534df43f224b212ded90fc4c9df83e421e7 Mon Sep 17 00:00:00 2001 From: rajeshreeputra Date: Tue, 14 Jan 2025 18:40:48 +0530 Subject: [PATCH 13/18] ACMS-4403: Add filter to import search related config for content recipes only. --- .../acquia_cms_search.services.yml | 4 +-- .../EventSubscriber/RecipeConfigImporter.php | 33 ++++++++++++------- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/modules/acquia_cms_search/acquia_cms_search.services.yml b/modules/acquia_cms_search/acquia_cms_search.services.yml index ac432a237..d5322085c 100644 --- a/modules/acquia_cms_search/acquia_cms_search.services.yml +++ b/modules/acquia_cms_search/acquia_cms_search.services.yml @@ -1,8 +1,6 @@ services: acquia_cms_search.recipe_config_importer: class: Drupal\acquia_cms_search\EventSubscriber\RecipeConfigImporter - arguments: - - '@config.factory' - # - '@config.installer' + arguments: ['@config.factory', '@config.installer'] tags: - { name: event_subscriber } diff --git a/modules/acquia_cms_search/src/EventSubscriber/RecipeConfigImporter.php b/modules/acquia_cms_search/src/EventSubscriber/RecipeConfigImporter.php index 622ba179c..a3816ec6d 100644 --- a/modules/acquia_cms_search/src/EventSubscriber/RecipeConfigImporter.php +++ b/modules/acquia_cms_search/src/EventSubscriber/RecipeConfigImporter.php @@ -3,7 +3,7 @@ namespace Drupal\acquia_cms_search\EventSubscriber; use Drupal\Core\Config\ConfigFactoryInterface; -use Drupal\Core\Config\ConfigInstaller; +use Drupal\Core\Config\ConfigInstallerInterface; use Drupal\Core\Config\FileStorage; use Drupal\Core\Recipe\RecipeAppliedEvent; use Symfony\Component\EventDispatcher\EventSubscriberInterface; @@ -16,6 +16,13 @@ */ class RecipeConfigImporter implements EventSubscriberInterface { + const CONTENT_MODEL_RECIPES = [ + 'acquia_starterkit_article', + 'acquia_starterkit_event', + 'acquia_starterkit_person', + 'acquia_starterkit_place', + ]; + /** * The config factory service. * @@ -35,15 +42,15 @@ class RecipeConfigImporter implements EventSubscriberInterface { * * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory * The config factory service. - // * @param \Drupal\Core\Config\ConfigInstaller $config_installer - // * The config installer service. + * @param \Drupal\Core\Config\ConfigInstallerInterface $config_installer + * The config installer service. */ public function __construct( ConfigFactoryInterface $config_factory, - // ConfigInstaller $config_installer, + ConfigInstallerInterface $config_installer, ) { $this->configFactory = $config_factory; - // $this->configInstaller = $config_installer; + $this->configInstaller = $config_installer; } /** @@ -64,13 +71,16 @@ public static function getSubscribedEvents(): array { public function onRecipeApply(RecipeAppliedEvent $event): void { $recipe_name = $this->getRecipeName($event->recipe->path); if ($recipe_name == 'acquia_starterkit_search') { - // $this->configInstaller->installOptionalConfig(NULL, ['module' => 'acquia_cms_search']); - \Drupal::service('config.installer')->installOptionalConfig(NULL, [ + $this->configInstaller->installOptionalConfig(NULL, [ 'module' => 'acquia_cms_search' ]); + $this->importConfigFromRecipe($event->recipe->path); $this->importSearchConfig(); } - elseif (str_starts_with($recipe_name, 'acquia_starterkit_')) { + elseif ( + str_starts_with($recipe_name, 'acquia_starterkit_') && + in_array($recipe_name, self::CONTENT_MODEL_RECIPES) + ) { $this->importConfigFromRecipe($event->recipe->path); } } @@ -93,7 +103,9 @@ private function getRecipeName(string $path): string { * Imports search configuration if it exists. */ private function importSearchConfig(): void { - $recipes = $this->configFactory->get('acquia_starterkit_core.settings')->get('recipes_applied') ?? []; + $recipes_applied = $this->configFactory->get('acquia_starterkit_core.settings')->get('recipes_applied') ?? []; + // Filter recipes that are search related. + $recipes = array_intersect($recipes_applied, self::CONTENT_MODEL_RECIPES); foreach ($recipes as $recipe) { $recipe_path = $this->getRecipePathByName($recipe); $this->importConfigFromRecipe($recipe_path . '/' . $recipe); @@ -123,8 +135,7 @@ private function importConfigFromRecipe(string $recipe_path): void { */ private function importConfigFromPath(string $config_path): void { $config_source = new FileStorage($config_path); - // $this->configInstaller->installOptionalConfig($config_source); - \Drupal::service('config.installer')->installOptionalConfig($config_source); + $this->configInstaller->installOptionalConfig($config_source); } /** From 0f7be20bf1fc5ffcfe33d7fb34265eca2bc804bb Mon Sep 17 00:00:00 2001 From: rajeshreeputra Date: Wed, 15 Jan 2025 14:26:10 +0530 Subject: [PATCH 14/18] ACMS-4403: Restore the remove search views in content types modules. --- .../config/optional/views.view.articles.yml | 357 +++++++++++++++++ .../config/optional/views.view.events.yml | 376 ++++++++++++++++++ .../config/optional/views.view.people.yml | 373 +++++++++++++++++ .../config/optional/views.view.places.yml | 352 ++++++++++++++++ 4 files changed, 1458 insertions(+) create mode 100644 modules/acquia_cms_article/config/optional/views.view.articles.yml create mode 100644 modules/acquia_cms_event/config/optional/views.view.events.yml create mode 100644 modules/acquia_cms_person/config/optional/views.view.people.yml create mode 100644 modules/acquia_cms_place/config/optional/views.view.places.yml diff --git a/modules/acquia_cms_article/config/optional/views.view.articles.yml b/modules/acquia_cms_article/config/optional/views.view.articles.yml new file mode 100644 index 000000000..777fea2d1 --- /dev/null +++ b/modules/acquia_cms_article/config/optional/views.view.articles.yml @@ -0,0 +1,357 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_article_type + - search_api.index.content + - views.view.articles_fallback + module: + - acquia_cms_search + - search_api + - user +id: articles +label: Articles +module: views +description: '' +tag: '' +base_table: search_api_index_content +base_field: search_api_id +display: + default: + id: default + display_title: Master + display_plugin: default + position: 0 + display_options: + title: Articles + fields: + field_article_type: + id: field_article_type + table: search_api_index_content + field: field_article_type + relationship: none + group_type: group + admin_label: '' + entity_type: null + entity_field: null + plugin_id: search_api_field + label: '' + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: target_id + type: entity_reference_label + settings: { } + group_column: target_id + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + field_rendering: true + fallback_handler: search_api_entity + fallback_options: + link_to_item: false + use_highlighting: false + multi_type: separator + multi_separator: ', ' + display_methods: { } + pager: + type: full + options: + offset: 0 + pagination_heading_level: h4 + items_per_page: 10 + total_pages: null + id: 0 + tags: + next: 'Next ›' + previous: '‹ Previous' + first: '« First' + last: 'Last »' + expose: + items_per_page: false + items_per_page_label: 'Items per page' + items_per_page_options: '5, 10, 25, 50' + items_per_page_options_all: false + items_per_page_options_all_label: '- All -' + offset: false + offset_label: Offset + quantity: 5 + exposed_form: + type: basic + options: + submit_button: Apply + reset_button: false + reset_button_label: Reset + exposed_sorts_label: 'Sort by' + expose_sort_order: true + sort_asc_label: Asc + sort_desc_label: Desc + access: + type: perm + options: + perm: 'access content' + cache: + type: search_api_tag + options: { } + empty: + view_fallback: + id: view_fallback + table: views + field: view_fallback + relationship: none + group_type: group + admin_label: '' + plugin_id: view_fallback + empty: true + view_to_insert: 'articles_fallback:default' + inherit_arguments: 0 + main_listing_pages_view: + id: main_listing_pages_view + table: views + field: main_listing_pages_view + relationship: none + group_type: group + admin_label: '' + plugin_id: main_listing_pages_view + empty: true + tokenize: 0 + content: + value: 'Sorry, no content found. Please try to search with different keywords.' + format: filtered_html + sorts: + created: + id: created + table: search_api_index_content + field: created + relationship: none + group_type: group + admin_label: '' + plugin_id: search_api + order: DESC + expose: + label: '' + field_identifier: created + exposed: false + arguments: { } + filters: + published: + id: published + table: search_api_index_content + field: published + relationship: none + group_type: group + admin_label: '' + plugin_id: search_api_boolean + operator: '=' + value: '1' + group: 1 + exposed: false + expose: + operator_id: '' + label: '' + description: '' + use_operator: false + operator: '' + operator_limit_selection: false + operator_list: { } + identifier: '' + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + is_grouped: false + group_info: + label: '' + description: '' + identifier: '' + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: { } + type: + id: type + table: search_api_index_content + field: type + relationship: none + group_type: group + admin_label: '' + plugin_id: search_api_options + operator: or + value: + article: article + group: 1 + exposed: false + expose: + operator_id: '' + label: '' + description: '' + use_operator: false + operator: '' + operator_limit_selection: false + operator_list: { } + identifier: '' + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + reduce: false + is_grouped: false + group_info: + label: '' + description: '' + identifier: '' + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: { } + reduce_duplicates: false + search_api_language: + id: search_api_language + table: search_api_index_content + field: search_api_language + relationship: none + group_type: group + admin_label: '' + plugin_id: search_api_language + operator: in + value: + '***LANGUAGE_language_interface***': '***LANGUAGE_language_interface***' + group: 1 + exposed: false + expose: + operator_id: '' + label: '' + description: '' + use_operator: false + operator: '' + operator_limit_selection: false + operator_list: { } + identifier: '' + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + reduce: false + is_grouped: false + group_info: + label: '' + description: '' + identifier: '' + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: { } + filter_groups: + operator: AND + groups: + 1: AND + style: + type: default + row: + type: search_api + query: + type: search_api_query + options: + bypass_access: false + skip_access: false + preserve_facet_query_args: false + relationships: { } + use_ajax: false + header: { } + footer: { } + display_extenders: { } + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url.path + - url.query_args + - 'user.node_grants:view' + - user.permissions + tags: + - 'config:field.storage.node.field_article_type' + - 'config:search_api.index.content' + - 'search_api_list:content' + page: + id: page + display_title: Page + display_plugin: page + position: 1 + display_options: + cache: + type: search_api_none + options: { } + defaults: + cache: false + exposed_block: true + display_extenders: { } + path: articles + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url.path + - url.query_args + - 'user.node_grants:view' + - user.permissions + tags: + - 'config:field.storage.node.field_article_type' + - 'config:search_api.index.content' + - 'search_api_list:content' diff --git a/modules/acquia_cms_event/config/optional/views.view.events.yml b/modules/acquia_cms_event/config/optional/views.view.events.yml new file mode 100644 index 000000000..2a06b3e23 --- /dev/null +++ b/modules/acquia_cms_event/config/optional/views.view.events.yml @@ -0,0 +1,376 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_event_type + - search_api.index.content + - views.view.events_fallback + module: + - acquia_cms_search + - search_api + - user +id: events +label: Events +module: views +description: '' +tag: '' +base_table: search_api_index_content +base_field: search_api_id +display: + default: + id: default + display_title: Master + display_plugin: default + position: 0 + display_options: + title: Events + fields: + field_event_type: + id: field_event_type + table: search_api_index_content + field: field_event_type + relationship: none + group_type: group + admin_label: '' + plugin_id: search_api_field + label: '' + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: target_id + type: entity_reference_label + settings: + link: true + group_column: target_id + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + field_rendering: true + fallback_handler: search_api_entity + fallback_options: + link_to_item: false + use_highlighting: false + multi_type: separator + multi_separator: ', ' + display_methods: + article_type: + display_method: label + categories: + display_method: label + event_type: + display_method: label + person_type: + display_method: label + place_type: + display_method: label + tags: + display_method: label + pager: + type: full + options: + offset: 0 + pagination_heading_level: h4 + items_per_page: 10 + total_pages: null + id: 0 + tags: + next: 'Next ›' + previous: '‹ Previous' + first: '« First' + last: 'Last »' + expose: + items_per_page: false + items_per_page_label: 'Items per page' + items_per_page_options: '5, 10, 25, 50' + items_per_page_options_all: false + items_per_page_options_all_label: '- All -' + offset: false + offset_label: Offset + quantity: 5 + exposed_form: + type: basic + options: + submit_button: Apply + reset_button: false + reset_button_label: Reset + exposed_sorts_label: 'Sort by' + expose_sort_order: true + sort_asc_label: Asc + sort_desc_label: Desc + access: + type: perm + options: + perm: 'access content' + cache: + type: search_api_tag + options: { } + empty: + view_fallback: + id: view_fallback + table: views + field: view_fallback + relationship: none + group_type: group + admin_label: '' + plugin_id: view_fallback + empty: true + view_to_insert: 'events_fallback:default' + inherit_arguments: 0 + main_listing_pages_view: + id: main_listing_pages_view + table: views + field: main_listing_pages_view + relationship: none + group_type: group + admin_label: '' + plugin_id: main_listing_pages_view + empty: true + tokenize: 0 + content: + value: 'Sorry, no content found. Please try to search with different keywords.' + format: filtered_html + sorts: + field_event_start: + id: field_event_start + table: search_api_index_content + field: field_event_start + relationship: none + group_type: group + admin_label: '' + plugin_id: search_api + order: ASC + expose: + label: '' + field_identifier: field_event_start + exposed: false + title: + id: title + table: search_api_index_content + field: title + relationship: none + group_type: group + admin_label: '' + plugin_id: search_api + order: ASC + expose: + label: '' + field_identifier: title + exposed: false + arguments: { } + filters: + type: + id: type + table: search_api_index_content + field: type + relationship: none + group_type: group + admin_label: '' + plugin_id: search_api_options + operator: or + value: + event: event + group: 1 + exposed: false + expose: + operator_id: '' + label: '' + description: '' + use_operator: false + operator: '' + operator_limit_selection: false + operator_list: { } + identifier: '' + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + reduce: false + is_grouped: false + group_info: + label: '' + description: '' + identifier: '' + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: { } + reduce_duplicates: false + published: + id: published + table: search_api_index_content + field: published + relationship: none + group_type: group + admin_label: '' + plugin_id: search_api_boolean + operator: '=' + value: '1' + group: 1 + exposed: false + expose: + operator_id: '' + label: '' + description: '' + use_operator: false + operator: '' + operator_limit_selection: false + operator_list: { } + identifier: '' + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + is_grouped: false + group_info: + label: '' + description: '' + identifier: '' + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: { } + search_api_language: + id: search_api_language + table: search_api_index_content + field: search_api_language + relationship: none + group_type: group + admin_label: '' + plugin_id: search_api_language + operator: in + value: + '***LANGUAGE_language_interface***': '***LANGUAGE_language_interface***' + group: 1 + exposed: false + expose: + operator_id: '' + label: '' + description: '' + use_operator: false + operator: '' + operator_limit_selection: false + operator_list: { } + identifier: '' + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + reduce: false + is_grouped: false + group_info: + label: '' + description: '' + identifier: '' + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: { } + style: + type: default + row: + type: search_api + query: + type: search_api_query + options: + bypass_access: false + skip_access: false + preserve_facet_query_args: false + relationships: { } + header: { } + footer: { } + display_extenders: { } + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url.path + - url.query_args + - 'user.node_grants:view' + - user.permissions + tags: + - 'config:field.storage.node.field_event_type' + - 'config:search_api.index.content' + - 'search_api_list:content' + page: + id: page + display_title: Page + display_plugin: page + position: 1 + display_options: + cache: + type: search_api_none + options: { } + defaults: + cache: false + exposed_block: true + display_extenders: { } + path: events + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url.path + - url.query_args + - 'user.node_grants:view' + - user.permissions + tags: + - 'config:field.storage.node.field_event_type' + - 'config:search_api.index.content' + - 'search_api_list:content' diff --git a/modules/acquia_cms_person/config/optional/views.view.people.yml b/modules/acquia_cms_person/config/optional/views.view.people.yml new file mode 100644 index 000000000..d933c7edc --- /dev/null +++ b/modules/acquia_cms_person/config/optional/views.view.people.yml @@ -0,0 +1,373 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_person_type + - search_api.index.content + - views.view.people_fallback + module: + - acquia_cms_search + - search_api + - user +id: people +label: People +module: views +description: '' +tag: '' +base_table: search_api_index_content +base_field: search_api_id +display: + default: + id: default + display_title: Master + display_plugin: default + position: 0 + display_options: + title: People + fields: + field_person_type: + id: field_person_type + table: search_api_index_content + field: field_person_type + relationship: none + group_type: group + admin_label: '' + plugin_id: search_api_field + label: '' + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: target_id + type: entity_reference_label + settings: + link: true + group_column: target_id + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + field_rendering: true + fallback_handler: search_api_entity + fallback_options: + link_to_item: false + use_highlighting: false + multi_type: separator + multi_separator: ', ' + display_methods: + article_type: + display_method: label + categories: + display_method: label + event_type: + display_method: label + person_type: + display_method: label + place_type: + display_method: label + tags: + display_method: label + pager: + type: full + options: + offset: 0 + pagination_heading_level: h4 + items_per_page: 9 + total_pages: null + id: 0 + tags: + next: 'Next ›' + previous: '‹ Previous' + first: '« First' + last: 'Last »' + expose: + items_per_page: false + items_per_page_label: 'Items per page' + items_per_page_options: '5, 10, 25, 50' + items_per_page_options_all: false + items_per_page_options_all_label: '- All -' + offset: false + offset_label: Offset + quantity: 5 + exposed_form: + type: basic + options: + submit_button: Apply + reset_button: false + reset_button_label: Reset + exposed_sorts_label: 'Sort by' + expose_sort_order: true + sort_asc_label: Asc + sort_desc_label: Desc + access: + type: perm + options: + perm: 'access content' + cache: + type: search_api_tag + options: { } + empty: + view_fallback: + id: view_fallback + table: views + field: view_fallback + relationship: none + group_type: group + admin_label: '' + plugin_id: view_fallback + empty: true + view_to_insert: 'people_fallback:default' + inherit_arguments: 0 + main_listing_pages_view: + id: main_listing_pages_view + table: views + field: main_listing_pages_view + relationship: none + group_type: group + admin_label: '' + plugin_id: main_listing_pages_view + empty: true + tokenize: 0 + content: + value: 'Sorry, no content found. Please try to search with different keywords.' + format: filtered_html + sorts: + title: + id: title + table: search_api_index_content + field: title + relationship: none + group_type: group + admin_label: '' + plugin_id: search_api + order: ASC + expose: + label: '' + field_identifier: title + exposed: false + arguments: { } + filters: + type: + id: type + table: search_api_index_content + field: type + relationship: none + group_type: group + admin_label: '' + plugin_id: search_api_options + operator: or + value: + person: person + group: 1 + exposed: false + expose: + operator_id: '' + label: '' + description: '' + use_operator: false + operator: '' + operator_limit_selection: false + operator_list: { } + identifier: '' + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + reduce: false + is_grouped: false + group_info: + label: '' + description: '' + identifier: '' + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: { } + reduce_duplicates: false + published: + id: published + table: search_api_index_content + field: published + relationship: none + group_type: group + admin_label: '' + plugin_id: search_api_boolean + operator: '=' + value: '1' + group: 1 + exposed: false + expose: + operator_id: '' + label: '' + description: '' + use_operator: false + operator: '' + operator_limit_selection: false + operator_list: { } + identifier: '' + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + is_grouped: false + group_info: + label: '' + description: '' + identifier: '' + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: { } + search_api_language: + id: search_api_language + table: search_api_index_content + field: search_api_language + relationship: none + group_type: group + admin_label: '' + plugin_id: search_api_language + operator: in + value: + '***LANGUAGE_language_interface***': '***LANGUAGE_language_interface***' + group: 1 + exposed: false + expose: + operator_id: '' + label: '' + description: '' + use_operator: false + operator: '' + operator_limit_selection: false + operator_list: { } + identifier: '' + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + reduce: false + is_grouped: false + group_info: + label: '' + description: '' + identifier: '' + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: { } + style: + type: default + row: + type: search_api + options: + view_modes: + 'entity:node': + article: default + event: default + page: default + person: card + place: default + query: + type: search_api_query + options: + bypass_access: false + skip_access: false + preserve_facet_query_args: false + relationships: { } + header: { } + footer: { } + display_extenders: { } + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url.path + - url.query_args + - 'user.node_grants:view' + - user.permissions + tags: + - 'config:field.storage.node.field_person_type' + - 'config:search_api.index.content' + - 'search_api_list:content' + page: + id: page + display_title: Page + display_plugin: page + position: 1 + display_options: + cache: + type: search_api_tag + options: { } + defaults: + cache: false + exposed_block: true + display_extenders: { } + path: people + cache_metadata: + max-age: 0 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url.path + - url.query_args + - 'user.node_grants:view' + - user.permissions + tags: + - 'config:facets.facet.people_category' + - 'config:facets.facet.people_person_type' + - 'config:field.storage.node.field_person_type' + - 'config:search_api.index.content' + - 'search_api_list:content' diff --git a/modules/acquia_cms_place/config/optional/views.view.places.yml b/modules/acquia_cms_place/config/optional/views.view.places.yml new file mode 100644 index 000000000..90224926b --- /dev/null +++ b/modules/acquia_cms_place/config/optional/views.view.places.yml @@ -0,0 +1,352 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_place_type + - search_api.index.content + - views.view.places_fallback + module: + - acquia_cms_search + - search_api + - user +id: places +label: Places +module: views +description: '' +tag: '' +base_table: search_api_index_content +base_field: search_api_id +display: + default: + id: default + display_title: Master + display_plugin: default + position: 0 + display_options: + title: Places + fields: + field_place_type: + id: field_place_type + table: search_api_index_content + field: field_place_type + relationship: none + group_type: group + admin_label: '' + entity_type: null + entity_field: null + plugin_id: search_api_field + label: '' + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: target_id + type: entity_reference_label + settings: { } + group_column: target_id + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + field_rendering: true + fallback_handler: search_api_entity + fallback_options: + link_to_item: false + use_highlighting: false + multi_type: separator + multi_separator: ', ' + display_methods: { } + pager: + type: full + options: + offset: 0 + pagination_heading_level: h4 + items_per_page: 10 + total_pages: null + id: 0 + tags: + next: 'Next ›' + previous: '‹ Previous' + first: '« First' + last: 'Last »' + expose: + items_per_page: false + items_per_page_label: 'Items per page' + items_per_page_options: '5, 10, 25, 50' + items_per_page_options_all: false + items_per_page_options_all_label: '- All -' + offset: false + offset_label: Offset + quantity: 5 + exposed_form: + type: basic + options: + submit_button: Apply + reset_button: false + reset_button_label: Reset + exposed_sorts_label: 'Sort by' + expose_sort_order: true + sort_asc_label: Asc + sort_desc_label: Desc + access: + type: perm + options: + perm: 'access content' + cache: + type: search_api_tag + options: { } + empty: + view_fallback: + id: view_fallback + table: views + field: view_fallback + relationship: none + group_type: group + admin_label: '' + plugin_id: view_fallback + empty: true + view_to_insert: 'places_fallback:default' + inherit_arguments: 0 + main_listing_pages_view: + id: main_listing_pages_view + table: views + field: main_listing_pages_view + relationship: none + group_type: group + admin_label: '' + plugin_id: main_listing_pages_view + empty: true + tokenize: 0 + content: + value: 'Sorry, no content found. Please try to search with different keywords.' + format: filtered_html + sorts: + title: + id: title + table: search_api_index_content + field: title + relationship: none + group_type: group + admin_label: '' + plugin_id: search_api + order: ASC + expose: + label: '' + field_identifier: title + exposed: false + arguments: { } + filters: + type: + id: type + table: search_api_index_content + field: type + relationship: none + group_type: group + admin_label: '' + plugin_id: search_api_options + operator: or + value: + place: place + group: 1 + exposed: false + expose: + operator_id: '' + label: '' + description: '' + use_operator: false + operator: '' + operator_limit_selection: false + operator_list: { } + identifier: '' + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + reduce: false + is_grouped: false + group_info: + label: '' + description: '' + identifier: '' + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: { } + reduce_duplicates: false + published: + id: published + table: search_api_index_content + field: published + relationship: none + group_type: group + admin_label: '' + plugin_id: search_api_boolean + operator: '=' + value: '1' + group: 1 + exposed: false + expose: + operator_id: '' + label: '' + description: '' + use_operator: false + operator: '' + operator_limit_selection: false + operator_list: { } + identifier: '' + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + is_grouped: false + group_info: + label: '' + description: '' + identifier: '' + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: { } + search_api_language: + id: search_api_language + table: search_api_index_content + field: search_api_language + relationship: none + group_type: group + admin_label: '' + plugin_id: search_api_language + operator: in + value: + '***LANGUAGE_language_interface***': '***LANGUAGE_language_interface***' + group: 1 + exposed: false + expose: + operator_id: '' + label: '' + description: '' + use_operator: false + operator: '' + operator_limit_selection: false + operator_list: { } + identifier: '' + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + reduce: false + is_grouped: false + group_info: + label: '' + description: '' + identifier: '' + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: { } + style: + type: default + row: + type: search_api + query: + type: search_api_query + options: + bypass_access: false + skip_access: false + preserve_facet_query_args: false + relationships: { } + header: { } + footer: { } + display_extenders: { } + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url.path + - url.query_args + - 'user.node_grants:view' + - user.permissions + tags: + - 'config:field.storage.node.field_place_type' + - 'config:search_api.index.content' + - 'search_api_list:content' + page: + id: page + display_title: Page + display_plugin: page + position: 1 + display_options: + cache: + type: search_api_none + options: { } + defaults: + cache: false + exposed_block: true + display_extenders: { } + path: places + cache_metadata: + max-age: -1 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url.path + - url.query_args + - 'user.node_grants:view' + - user.permissions + tags: + - 'config:field.storage.node.field_place_type' + - 'config:search_api.index.content' + - 'search_api_list:content' From 262baece931afa62ef9c91026a24d41450e60dc3 Mon Sep 17 00:00:00 2001 From: rajeshreeputra Date: Wed, 15 Jan 2025 14:49:39 +0530 Subject: [PATCH 15/18] ACMS-4403: Restore the search config changes. --- .../block.block.clear_facet_filters.yml | 4 +++ .../block.block.exposed_form_search.yml | 1 + .../optional/block.block.search_category.yml | 1 + .../block.block.search_content_type.yml | 1 + .../search_api.server.database.yml | 0 .../search_api_autocomplete.search.search.yml | 34 ------------------- 6 files changed, 7 insertions(+), 34 deletions(-) rename modules/acquia_cms_search/config/{install => optional}/search_api.server.database.yml (100%) delete mode 100644 modules/acquia_cms_search/config/optional/search_api_autocomplete.search.search.yml diff --git a/modules/acquia_cms_search/config/optional/block.block.clear_facet_filters.yml b/modules/acquia_cms_search/config/optional/block.block.clear_facet_filters.yml index 7d9f4c960..90b47eb82 100644 --- a/modules/acquia_cms_search/config/optional/block.block.clear_facet_filters.yml +++ b/modules/acquia_cms_search/config/optional/block.block.clear_facet_filters.yml @@ -3,9 +3,13 @@ status: true dependencies: module: - acquia_cms_search + - cohesion - collapsiblock theme: - cohesion_theme +third_party_settings: + collapsiblock: + collapse_action: 0 id: clear_facet_filters theme: cohesion_theme region: dx8_hidden diff --git a/modules/acquia_cms_search/config/optional/block.block.exposed_form_search.yml b/modules/acquia_cms_search/config/optional/block.block.exposed_form_search.yml index 64c038119..1694dd340 100644 --- a/modules/acquia_cms_search/config/optional/block.block.exposed_form_search.yml +++ b/modules/acquia_cms_search/config/optional/block.block.exposed_form_search.yml @@ -4,6 +4,7 @@ dependencies: config: - views.view.search module: + - cohesion - views theme: - cohesion_theme diff --git a/modules/acquia_cms_search/config/optional/block.block.search_category.yml b/modules/acquia_cms_search/config/optional/block.block.search_category.yml index a3047b0ea..3cfd5a2cd 100644 --- a/modules/acquia_cms_search/config/optional/block.block.search_category.yml +++ b/modules/acquia_cms_search/config/optional/block.block.search_category.yml @@ -4,6 +4,7 @@ dependencies: config: - facets.facet.search_category module: + - cohesion - collapsiblock - facets theme: diff --git a/modules/acquia_cms_search/config/optional/block.block.search_content_type.yml b/modules/acquia_cms_search/config/optional/block.block.search_content_type.yml index 968182f7f..41370f512 100644 --- a/modules/acquia_cms_search/config/optional/block.block.search_content_type.yml +++ b/modules/acquia_cms_search/config/optional/block.block.search_content_type.yml @@ -4,6 +4,7 @@ dependencies: config: - facets.facet.search_content_type module: + - cohesion - collapsiblock - facets theme: diff --git a/modules/acquia_cms_search/config/install/search_api.server.database.yml b/modules/acquia_cms_search/config/optional/search_api.server.database.yml similarity index 100% rename from modules/acquia_cms_search/config/install/search_api.server.database.yml rename to modules/acquia_cms_search/config/optional/search_api.server.database.yml diff --git a/modules/acquia_cms_search/config/optional/search_api_autocomplete.search.search.yml b/modules/acquia_cms_search/config/optional/search_api_autocomplete.search.search.yml deleted file mode 100644 index 789ff60b0..000000000 --- a/modules/acquia_cms_search/config/optional/search_api_autocomplete.search.search.yml +++ /dev/null @@ -1,34 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - search_api.index.content - - views.view.search - module: - - views - - search_api_autocomplete -id: search -label: Search -index_id: content -suggester_settings: - live_results: - fields: { } - view_modes: { } - server: - fields: { } -suggester_weights: - live_results: 0 - server: 0 -suggester_limits: { } -search_settings: - 'views:search': - displays: - default: true - selected: { } -options: - limit: 10 - min_length: 1 - show_count: false - delay: null - submit_button_selector: ':submit' - autosubmit: true From 0565d788b1b7f0762b687562c0267b64bb30ce02 Mon Sep 17 00:00:00 2001 From: rajeshreeputra Date: Thu, 9 Jan 2025 10:49:36 +0530 Subject: [PATCH 16/18] ACMS-4237: Add patch for site studio drupal 11.1 compatibility. --- composer.json | 3 +++ composer.lock | 14 +++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index dd70c2e6d..03245b0cd 100644 --- a/composer.json +++ b/composer.json @@ -322,6 +322,9 @@ "drupal/core": "-p2" }, "patches": { + "acquia/cohesion": { + "3340269 - Site Studio Drupal 11.1 compatibility": "https://www.drupal.org/files/issues/2025-01-09/3340269-site-studio-drupal-11-1-compatibility.patch" + }, "drupal/core": { "3328187 - PHP Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in docroot/core/lib/Drupal/Core/Mail/Plugin/Mail/PhpMail.php on line 112": "https://git.drupalcode.org/project/drupal/-/merge_requests/3142.patch", "Fix failing test for site studio due to missing file": "https://gist.githubusercontent.com/chandan-singh7929/978c8c3c8b6f1e2de23492e7e562c0c3/raw/f0e7770d94be862e5495ca25662a0a0d5672b785/bypass-library-version-core.patch" diff --git a/composer.lock b/composer.lock index 4a55c2782..674993546 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": "f7f9e623cf8da30e566ee0d0052fb980", + "content-hash": "a285aa0789cbf1a0b52f8b799237b02c", "packages": [ { "name": "acquia/acquia-cms-starterkit", @@ -83,16 +83,16 @@ }, { "name": "acquia/cohesion", - "version": "8.0.1", + "version": "8.0.2", "source": { "type": "git", "url": "https://github.com/acquia/cohesion.git", - "reference": "9c1fe03d979508e4d606ed3033143f9b345bcce3" + "reference": "edea0bfa3ebc42c519b30d831aaf6fb19107030f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/acquia/cohesion/zipball/9c1fe03d979508e4d606ed3033143f9b345bcce3", - "reference": "9c1fe03d979508e4d606ed3033143f9b345bcce3", + "url": "https://api.github.com/repos/acquia/cohesion/zipball/edea0bfa3ebc42c519b30d831aaf6fb19107030f", + "reference": "edea0bfa3ebc42c519b30d831aaf6fb19107030f", "shasum": "" }, "require": { @@ -140,9 +140,9 @@ ], "description": "Site Studio", "support": { - "source": "https://github.com/acquia/cohesion/tree/8.0.1" + "source": "https://github.com/acquia/cohesion/tree/8.0.2" }, - "time": "2024-10-08T11:09:42+00:00" + "time": "2024-11-20T19:17:26+00:00" }, { "name": "acquia/cohesion-theme", From c1b022f4504040425b6f95d73ab846df113505dd Mon Sep 17 00:00:00 2001 From: rajeshreeputra Date: Wed, 15 Jan 2025 15:10:24 +0530 Subject: [PATCH 17/18] ACMS-4403: Remove common from search test and add search schema in common. --- .../config/schema/acquia_cms_common.schema.yml | 16 ++++++++++++++++ .../AcquiaFacetSearchTest.php | 1 - .../tests/src/Kernel/AcquiaFacetFacadeTest.php | 1 - 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/modules/acquia_cms_common/config/schema/acquia_cms_common.schema.yml b/modules/acquia_cms_common/config/schema/acquia_cms_common.schema.yml index d989799be..79c9eb351 100644 --- a/modules/acquia_cms_common/config/schema/acquia_cms_common.schema.yml +++ b/modules/acquia_cms_common/config/schema/acquia_cms_common.schema.yml @@ -48,3 +48,19 @@ acquia_cms_common.settings: starter_kit_name: type: string label: 'The starterkit name' + +# This is added to make test pass. +field.storage.*.*.third_party.acquia_cms_search: + type: mapping + label: 'Acquia CMS settings' + mapping: + # Allow fields to carry 'search_index' and 'search_label' settings. This is used + # by our facade to passively opt the field into a particular index. + # @see acquia_cms_search_field_storage_config_insert() + # @see \Drupal\acquia_cms_search\Facade\SearchFacade::addTaxonomyField() + search_index: + type: string + label: 'Machine name of Search API index to which this field should be added' + search_label: + type: string + label: 'The label of the field in the Search API index' diff --git a/modules/acquia_cms_search/tests/src/FunctionalJavascript/AcquiaFacetSearchTest.php b/modules/acquia_cms_search/tests/src/FunctionalJavascript/AcquiaFacetSearchTest.php index 1d8e0db0c..0e72bf5b8 100644 --- a/modules/acquia_cms_search/tests/src/FunctionalJavascript/AcquiaFacetSearchTest.php +++ b/modules/acquia_cms_search/tests/src/FunctionalJavascript/AcquiaFacetSearchTest.php @@ -21,7 +21,6 @@ class AcquiaFacetSearchTest extends BrowserTestBase { */ protected static $modules = [ 'block', - 'acquia_cms_common', 'acquia_cms_search', ]; diff --git a/modules/acquia_cms_search/tests/src/Kernel/AcquiaFacetFacadeTest.php b/modules/acquia_cms_search/tests/src/Kernel/AcquiaFacetFacadeTest.php index c70ea63e9..89d4a82a3 100644 --- a/modules/acquia_cms_search/tests/src/Kernel/AcquiaFacetFacadeTest.php +++ b/modules/acquia_cms_search/tests/src/Kernel/AcquiaFacetFacadeTest.php @@ -23,7 +23,6 @@ class AcquiaFacetFacadeTest extends KernelTestBase { 'facets', 'search_api', 'acquia_cms_search', - 'acquia_cms_common', ]; /** From 17281b81b31e942917b1807f92c6656750fc82d8 Mon Sep 17 00:00:00 2001 From: rajeshreeputra Date: Wed, 15 Jan 2025 15:56:54 +0530 Subject: [PATCH 18/18] ACMS-4403: Update logic to generate search_category facet when field_categories storage exists. --- .../acquia_cms_search.module | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/modules/acquia_cms_search/acquia_cms_search.module b/modules/acquia_cms_search/acquia_cms_search.module index 5c1105136..bf056835f 100644 --- a/modules/acquia_cms_search/acquia_cms_search.module +++ b/modules/acquia_cms_search/acquia_cms_search.module @@ -181,13 +181,21 @@ function acquia_cms_search_form_acquia_cms_search_form_alter(array &$form) { * Adds search_category facet, if any acms search dependent module is installed. */ function _acquia_cms_search_add_category_facet() { - $search_category = \Drupal::entityTypeManager()->getStorage('facets_facet')->loadByProperties(['id' => 'search_category']); - if (!$search_category) { - \Drupal::classResolver(FacetFacade::class)->addFacet([ - 'id' => 'search_category', - 'name' => 'Category', - 'url_alias' => 'category', - 'field_identifier' => 'field_categories', - ]); + // Check if field_categories field is available. + if (!\Drupal::entityTypeManager()->getStorage('field_storage_config')->loadByProperties(['field_name' => 'field_categories'])) { + return; } + + // Check if search_category facet is already created. + if (\Drupal::entityTypeManager()->getStorage('facets_facet')->loadByProperties(['id' => 'search_category'])) { + return; + } + + // Create search category facet. + \Drupal::classResolver(FacetFacade::class)->addFacet([ + 'id' => 'search_category', + 'name' => 'Category', + 'url_alias' => 'category', + 'field_identifier' => 'field_categories', + ]); }