You are here

function search_file_attachments_settings_form_validate in Search File Attachments 7

Validation handler for the settings form.

File

./search_file_attachments.admin.inc, line 74

Code

function search_file_attachments_settings_form_validate($form, &$form_state) {
  if (empty($form_state['values']['search_file_attachments_tika_jar'])) {
    form_set_error('search_file_attachments_tika_jar', t('Tika jar is mandatory.'));
  }
  $path = realpath($form_state['values']['search_file_attachments_tika_path']);
  if (!file_exists($path . '/' . $form_state['values']['search_file_attachments_tika_jar'])) {
    form_set_error('search_file_attachments_tika_path', t('Tika jar file not found at this path.'));
  }
  if (isset($form_state['values']['search_file_attachments_java_path']) && !search_file_attachments_check_java($form_state['values']['search_file_attachments_java_path'])) {
    form_set_error('search_file_attachments_java_path', t('Java was not found or is executable at the specified path.'));
  }
}