You are here

function search_api_views_views_plugins in Search API 7

Implements hook_views_plugins().

File

contrib/search_api_views/search_api_views.views.inc, line 252
Views hook implementations for the Search API Views module.

Code

function search_api_views_views_plugins() {

  // Collect all base tables provided by this module.
  $bases = array();
  foreach (search_api_index_load_multiple(FALSE) as $index) {
    $bases[] = 'search_api_index_' . $index->machine_name;
  }
  $ret = array(
    'query' => array(
      'search_api_views_query' => array(
        'title' => t('Search API Query'),
        'help' => t('Query will be generated and run using the Search API.'),
        'handler' => 'SearchApiViewsQuery',
      ),
    ),
    'cache' => array(
      'search_api_views_cache' => array(
        'title' => t('Search-specific'),
        'help' => t("Cache Search API views. (Other methods probably won't work with search views.)"),
        'base' => $bases,
        'handler' => 'SearchApiViewsCache',
        'uses options' => TRUE,
      ),
    ),
  );
  if (module_exists('search_api_facetapi')) {
    $ret['display']['search_api_views_facets_block'] = array(
      'title' => t('Facets block'),
      'help' => t('Display facets for this search as a block anywhere on the site.'),
      'handler' => 'SearchApiViewsFacetsBlockDisplay',
      'uses hook block' => TRUE,
      'use ajax' => FALSE,
      'use pager' => FALSE,
      'use more' => TRUE,
      'accept attachments' => TRUE,
      'admin' => t('Facets block'),
    );
  }
  if (module_exists('views_content_cache')) {
    $ret['cache']['search_api_views_content_cache'] = array(
      'title' => t('Search-specific content-based'),
      'help' => t("Cache Search API views based on content updates. (Requires Views Content Cache)"),
      'base' => $bases,
      'handler' => 'SearchApiViewsContentCache',
      'uses options' => TRUE,
    );
  }
  return $ret;
}