You are here

function search_api_admin_index_edit_submit in Search API 7

Form submission handler for search_api_admin_index_edit().

See also

search_api_admin_index_edit_validate()

File

./search_api.admin.inc, line 1422
Administration page callbacks for the Search API module.

Code

function search_api_admin_index_edit_submit(array $form, array &$form_state) {
  form_state_values_clean($form_state);
  $values = $form_state['values'];

  /** @var SearchApiIndex $index */
  $index = $form_state['index'];
  if (!empty($form['options']['datasource'])) {
    $index
      ->datasource()
      ->configurationFormSubmit($form['options']['datasource'], $values['options']['datasource'], $form_state);
  }
  $values['options'] += $index->options;
  $ret = $index
    ->update($values);
  $form_state['redirect'] = 'admin/config/search/search_api/index/' . $index->machine_name;
  if ($ret) {
    drupal_set_message(t('The search index was successfully edited.'));
  }
  else {
    drupal_set_message(t('No values were changed.'));
  }
}