You are here

function search_api_attachments_settings_form in Search API attachments 7

Page callback to show the settings for the attachments.

1 string reference to 'search_api_attachments_settings_form'
search_api_attachments_menu in ./search_api_attachments.module
Implements hook_menu().

File

./search_api_attachments.admin.inc, line 11
Admin settings.

Code

function search_api_attachments_settings_form($form, &$form_state) {
  $form['search_api_attachments_extract_using'] = array(
    '#type' => 'radios',
    '#title' => t('Extraction method'),
    '#options' => array(
      'pdftotext' => t('Pdftotext'),
      'python_pdf2txt' => t('Pdf2txt (local python application)'),
      'solr' => t('Solr (remote server)'),
      'tika' => t('Tika (local java application)'),
      'tika_server' => t('Tika (server)'),
    ),
    '#description' => t('Choose extraction method, remote or local (extraction will be faster if run locally using tika).'),
    '#default_value' => variable_get('search_api_attachments_extract_using', 'tika'),
  );
  $form['search_api_attachments_tika_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Tika extraction settings'),
    '#description' => t('Required if using the "Tika" extraction method (above).'),
    '#collapsible' => TRUE,
  );
  $form['search_api_attachments_tika_settings']['search_api_attachments_tika_path'] = array(
    '#type' => 'textfield',
    '#title' => t('Tika directory path:'),
    '#default_value' => variable_get('search_api_attachments_tika_path', ''),
    '#description' => t('The full path to tika directory. All library jars must be in the same directory. E.g. /var/apache-tika-4.0/'),
  );
  $form['search_api_attachments_tika_settings']['search_api_attachments_tika_jar'] = array(
    '#type' => 'textfield',
    '#title' => t('Tika jar file:'),
    '#default_value' => variable_get('search_api_attachments_tika_jar', 'tika-app-1.6.jar'),
    '#description' => t('The name of the tika CLI application jar file, e.g. tika-app-1.6.jar.'),
  );
  $form['search_api_attachments_tika_server_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Tika server settings'),
    '#description' => t('Required if using the "Tika" server method (above).'),
    '#collapsible' => TRUE,
  );
  $form['search_api_attachments_tika_server_settings']['search_api_attachments_tika_server_host'] = array(
    '#type' => 'textfield',
    '#title' => t('Host:'),
    '#default_value' => variable_get('search_api_attachments_tika_server_host', 'localhost'),
    '#description' => t('The current host name, E.g. localhost'),
  );
  $form['search_api_attachments_tika_server_settings']['search_api_attachments_tika_server_port'] = array(
    '#type' => 'textfield',
    '#title' => t('Port:'),
    '#default_value' => variable_get('search_api_attachments_tika_server_port', 9998),
    '#description' => t('The port tika server is running on'),
  );
  $form['search_api_attachments_python_pdf2txt_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Pdf2txt extraction settings'),
    '#description' => t('Required if using the "Pdf2txt" extraction method (above).'),
    '#collapsible' => TRUE,
  );
  $form['search_api_attachments_python_pdf2txt_settings']['search_api_attachments_python_pdf2txt_path'] = array(
    '#type' => 'textfield',
    '#title' => t('Pdf2txt directory path:'),
    '#default_value' => variable_get('search_api_attachments_python_pdf2txt_path', '/usr/bin'),
    '#description' => t('The full path to python_pdf2txt directory. All library jars must be in the same directory. E.g. /usr/bin'),
  );
  $form['search_api_attachments_python_pdf2txt_settings']['search_api_attachments_python_pdf2txt_script'] = array(
    '#type' => 'textfield',
    '#title' => t('Pdf2txt Script file:'),
    '#default_value' => variable_get('search_api_attachments_python_pdf2txt_script', 'pdf2txt'),
    '#description' => t('The name of the pdf2txt Python Script file, e.g. pdf2txt.'),
  );
  $form['search_api_attachments_solr_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Solr extraction settings'),
    '#description' => t('Required if using the "Solr" extraction method (above).'),
    '#collapsible' => TRUE,
  );
  $form['search_api_attachments_solr_settings']['search_api_attachments_extracting_servlet_path'] = array(
    '#type' => 'textfield',
    '#title' => t('Solr extracting servlet path:'),
    '#default_value' => variable_get('search_api_attachments_extracting_servlet_path', 'update/extract'),
    '#description' => t('The path to the extracting servlet. E.g. update/extract or extract/tika'),
  );
  $form['search_api_attachments_cache_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Caching settings'),
    '#collapsible' => TRUE,
  );
  $form['search_api_attachments_cache_settings']['search_api_attachments_preserve_cache'] = array(
    '#type' => 'checkbox',
    '#default_value' => variable_get('search_api_attachments_preserve_cache', FALSE),
    '#title' => t('Preserve cached extractions across cache clears.'),
    '#description' => t('When checked, clearing the sidewide cache will not clear the cache of extracted files.'),
  );
  $form['search_api_attachments_debug'] = array(
    '#type' => 'checkbox',
    '#default_value' => variable_get('search_api_attachments_debug', FALSE),
    '#title' => t('Debug extraction of attachments.'),
    '#description' => t('When checked, debugging statements will be logged to watchdog.'),
  );
  return system_settings_form($form);
}