decoupled_kit_pantheon_search-1.0.x-dev/decoupled_kit_pantheon_search.install
decoupled_kit_pantheon_search.install
<?php
/**
* @file
* Install and update functions for decoupled_kit_pantheon_search module.
*/
use Drupal\search_api\Entity\Index;
use Drupal\search_api\IndexInterface;
/**
* Implements hook_install().
*/
function decoupled_kit_pantheon_search_install() {
// Load the search index and trigger the index to be updated.
$index = Index::load('example_index');
assert($index instanceof IndexInterface);
\Drupal::getContainer()
->get('search_api.index_task_manager')
->addItemsAll($index);
$index->indexItems();
}
