Search API: Mark index as read-only with a variable

Public

MY_MODULE.module

</> CopyGet raw version
php
  1. <?php
  2.  
  3. /**
  4.  * Implements hook_search_api_index_load().
  5.  */
  6. function MY_MODULE_search_api_index_load(array $indexes) {
  7. if (isset($indexes['default_node_index'])) {
  8. $indexes['default_node_index']->read_only = variable_get('search_api_default_node_index_read_only', FALSE);
  9. }
  10. }

settings.php

</> CopyGet raw version
php
  1. <?php
  2.  
  3. $conf['search_api_default_node_index_read_only'] = TRUE;