search_api_attachments.views.inc in Search API attachments 9.0.x
Same filename and directory in other branches
Adds views hooks.
File
search_api_attachments.views.incView source
<?php
/**
* @file
* Adds views hooks.
*/
use Drupal\search_api\Entity\Index;
/**
* Implements hook_views_data_alter().
*/
function search_api_attachments_views_data_alter(&$data) {
// Add the filter for each Search API's index.
foreach (Index::loadMultiple() as $index) {
if (!$index
->hasValidTracker() || !$index
->status()) {
continue;
}
$key = 'search_api_index_' . $index
->id();
$data[$key]['saa_exclude_attachments'] = [
'title' => t('Search api attachments filter'),
'filter' => [
'title' => t('Exclude search in attachments'),
'help' => 'Excludes searching in attachments',
'id' => 'search_api_attachments_include_search_in_attachments',
],
];
}
}
Functions
Name | Description |
---|---|
search_api_attachments_views_data_alter | Implements hook_views_data_alter(). |