You are here

function fillpdf_settings_validate in FillPDF 7

File

./fillpdf.admin.inc, line 114
Allows mappings of PDFs to site content.

Code

function fillpdf_settings_validate($form, &$form_state) {
  switch ($form_state['values']['fillpdf_service']) {
    case 'local_service':

      // Check for FillPDF LocalServer.
      $status = fillpdf_localservice_check($form_state['values']['fillpdf_local_service_endpoint']);
      if ($status === FALSE) {
        form_set_error('fillpdf_local_service_endpoint', t('FillPDF LocalService is not properly installed. Was unable to contact %local_server', array(
          '%local_server' => $form_state['values']['fillpdf_local_service_endpoint'],
        )));
      }
      break;
    case 'pdftk':

      // Check for pdftk.
      $status = fillpdf_pdftk_check($form_state['values']['fillpdf_pdftk_path']);
      if ($status === FALSE) {
        form_set_error('fillpdf_pdftk_path', t('The path you have entered for <em>pdftk</em> is invalid. Please enter a valid path.'));
      }
      break;
    case 'local':

      // Check for JavaBridge.
      $status = file_exists(drupal_get_path('module', 'fillpdf') . '/lib/JavaBridge/java/Java.inc');
      if ($status === FALSE) {
        form_set_error('local', t('JavaBridge is not installed locally.'));
      }
      break;
  }
}