From 18c5496ccc442b0ca40a97c6a3e9c9cc5c9dccf9 Mon Sep 17 00:00:00 2001 From: Vishal Khode Date: Thu, 27 Jun 2024 13:29:31 +0530 Subject: [PATCH] ACMS-4070: Fixed the search_api_none plugin does not exist error. --- .../acquia_cms_search.module | 18 ++++++++++ .../views/cache/SearchApiNoneCacheBC.php | 33 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 modules/acquia_cms_search/src/Plugin/views/cache/SearchApiNoneCacheBC.php diff --git a/modules/acquia_cms_search/acquia_cms_search.module b/modules/acquia_cms_search/acquia_cms_search.module index 60272acfe..06f3a9de6 100644 --- a/modules/acquia_cms_search/acquia_cms_search.module +++ b/modules/acquia_cms_search/acquia_cms_search.module @@ -42,6 +42,24 @@ function acquia_cms_search_views_plugins_query_alter(array &$definitions) { } } +/** + * Implements hook_views_plugins_cache_alter(). + */ +function acquia_cms_search_views_plugins_cache_alter(&$definitions) { + // This hook was implemented to provide backward compatibility for an issue + // that was fixed in search_api:8.x-1.32. A new views_cache plugin was, + // introduced, and accordingly, views configurations were updated. However, + // this change causes issues with Drupal Core 9.x because the release + // were new plugin was introduced doesn't support Drupal Core 9.x. + // @see https://www.drupal.org/project/search_api/issues/3423063. + // @todo Remove this & SearchApiNoneCacheBC, after we drop CORE 9.x support. + if (!isset($definitions['search_api_none'])) { + $definitions['search_api_none_bc']['id'] = 'search_api_none'; + $definitions['search_api_none'] = $definitions['search_api_none_bc']; + } + unset($definitions['search_api_none_bc']); +} + /** * Implements hook_ENTITY_TYPE_insert() for node types. */ diff --git a/modules/acquia_cms_search/src/Plugin/views/cache/SearchApiNoneCacheBC.php b/modules/acquia_cms_search/src/Plugin/views/cache/SearchApiNoneCacheBC.php new file mode 100644 index 000000000..01683b516 --- /dev/null +++ b/modules/acquia_cms_search/src/Plugin/views/cache/SearchApiNoneCacheBC.php @@ -0,0 +1,33 @@ +search_api_id; + } + +}