Skip to content

Commit

Permalink
Merge pull request #1850 from acquia/ACMS-4070
Browse files Browse the repository at this point in the history
ACMS-4070: Fixed the search_api_none plugin does not exist error.
  • Loading branch information
vishalkhode1 authored Sep 16, 2024
2 parents efc8f17 + 18c5496 commit 4273736
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
18 changes: 18 additions & 0 deletions modules/acquia_cms_search/acquia_cms_search.module
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace Drupal\acquia_cms_search\Plugin\views\cache;

use Drupal\views\Plugin\views\cache\None;
use Drupal\views\ResultRow;

/**
* Provides backward compatibility for search_api_none views cache type.
*
* This views_cache plugin was introduced in search_api:8.x-1.33, & search_api
* dropped support for Drupal Core 9.x starting from search_api:8.x-1.31.
*
* @see https://www.drupal.org/project/search_api/issues/3423063.
*
* @ingroup views_cache_plugins
*
* @ViewsCache(
* id = "search_api_none_bc",
* title = @Translation("Search API (none)"),
* help = @Translation("No caching of Views data.")
* )
*/
class SearchApiNoneCacheBC extends None {

/**
* {@inheritdoc}
*/
public function getRowId(ResultRow $row) {
return $row->search_api_id;
}

}

0 comments on commit 4273736

Please sign in to comment.