You are here

function search_api_admin_add_index_validate in Search API 7

Form validation handler for search_api_admin_add_index().

See also

search_api_admin_add_index_submit()

File

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

Code

function search_api_admin_add_index_validate(array $form, array &$form_state) {
  $values = $form_state['values'];
  $name = $values['machine_name'];
  if (is_numeric($name)) {
    form_set_error('machine_name', t('The machine name must not be a pure number.'));
  }
  if (!$values['datasource_config'] || empty($values['item_type']) || $values['item_type'] != $values['old_type']) {
    return;
  }
  $datasource = search_api_get_datasource_controller($values['item_type']);
  $datasource
    ->configurationFormValidate($form['datasource'], $form_state['values']['options']['datasource'], $form_state);
}