protected function SearchApiCachePluginTrait::getQuery in Search API 8
Retrieves the Search API Views query for the current view.
Return value
\Drupal\search_api\Plugin\views\query\SearchApiQuery|null The Search API Views query associated with the current view.
Throws
\Drupal\search_api\SearchApiException Thrown if there is no current Views query, or it is no Search API query.
File
- src/
Plugin/ views/ cache/ SearchApiCachePluginTrait.php, line 225
Class
- SearchApiCachePluginTrait
- Provides a trait to use in Views cache plugins for Search API queries.
Namespace
Drupal\search_api\Plugin\views\cacheCode
protected function getQuery() {
$query = $this
->getView()
->getQuery();
if ($query instanceof SearchApiQuery) {
return $query;
}
throw new SearchApiException('No matching Search API Views query found in view.');
}