elasticsearch_search_api-1.0.x-dev/elasticsearch_search_api.install
elasticsearch_search_api.install
<?php
/**
* @file
* Install, update and uninstall functions.
*/
use Drupal\elasticsearch_search_api\Utility\UtilityHelper;
use Drupal\node\Entity\NodeType;
/**
* Enable the 'search_index' view mode for every content type.
*
* By default, created view_mode references will only display node title,
* the rest of the fields will need to be configured manually.
*/
function elasticsearch_search_api_install() {
if (!\Drupal::moduleHandler()->moduleExists('node')) {
return;
}
$content_types = NodeType::loadMultiple();
foreach ($content_types as $content_type) {
UtilityHelper::configureSearchIndexViewMode($content_type);
}
}
