Skip to content

Commit

Permalink
ACMS-000: Remove Acquia CMS Common dependency from Acquia CMS Search.
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalkhode1 committed Dec 26, 2024
1 parent 033a896 commit 7a55aa5
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 26 deletions.
1 change: 0 additions & 1 deletion modules/acquia_cms_search/acquia_cms_search.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion modules/acquia_cms_search/acquia_cms_search.install
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ function acquia_cms_search_install($is_syncing) {

/**
* 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.
Expand Down
25 changes: 4 additions & 21 deletions modules/acquia_cms_search/acquia_cms_search.module
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ 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')
$field_storage->setThirdPartySetting('acquia_cms_search', 'search_index', 'content')
->setThirdPartySetting('acquia_cms_search', 'search_label', 'Body')
->save();
}

Expand Down Expand Up @@ -136,34 +136,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().
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
search_api.index.*.third_party.acquia_cms_common:
search_api.index.*.third_party.acquia_cms_search:
type: mapping
label: 'Acquia CMS settings'
label: 'Acquia CMS Search settings'
mapping:
# @see acquia_cms_search_search_api_server_insert()
search_server:
type: string
label: 'Machine name of Search API server to which the index will be attached'
# @see acquia_cms_search_node_type_insert()
search_index:
type: string
label: 'Machine name of Search API index to which the index will be attached'

0 comments on commit 7a55aa5

Please sign in to comment.