You are here

function search_api_form_views_ui_edit_display_form_alter in Search API 8

Implements hook_form_FORM_ID_alter() for form "views_ui_edit_display_form".

File

./search_api.module, line 526
Provides a rich framework for creating searches.

Code

function search_api_form_views_ui_edit_display_form_alter(&$form, FormStateInterface $form_state) {

  // Disable Views' default caching mechanisms on Search API views.
  $displays = $form_state
    ->getStorage()['view']
    ->get('display');
  if ($displays['default']['display_options']['query']['type'] === 'search_api_query') {
    unset($form['options']['cache']['type']['#options']['tag']);
    unset($form['options']['cache']['type']['#options']['time']);
  }
}