public function SearchFileAttachmentsSettingsForm::buildForm in Search File Attachments 8
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides ConfigFormBase::buildForm
File
- src/
Form/ SearchFileAttachmentsSettingsForm.php, line 42
Class
- SearchFileAttachmentsSettingsForm
- Configure search file attachments settings.
Namespace
Drupal\search_file_attachments\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config('search_file_attachments.settings');
// Apache Tika configuration.
$form['tika'] = array(
'#type' => 'fieldset',
'#title' => t('Apache Tika'),
);
$form['tika']['search_file_attachments_tika_path'] = array(
'#type' => 'textfield',
'#title' => t('Tika directory path'),
'#default_value' => $config
->get('tika.path'),
'#description' => t('The full path to tika directory.'),
'#required' => TRUE,
);
$form['tika']['search_file_attachments_tika_jar'] = array(
'#type' => 'textfield',
'#title' => t('Tika jar file'),
'#default_value' => $config
->get('tika.jar'),
'#description' => t('The name of the tika CLI application jar file, e.g. tika-app-1.xx.jar.'),
'#required' => TRUE,
);
if (!$this->javaService
->checkJava()) {
$form['tika']['search_file_attachments_java_path'] = array(
'#type' => 'textfield',
'#title' => t('Java path'),
'#default_value' => $config
->get('java_path'),
'#description' => t('The full path to the Java binary. This setting is only needed if Java could not automatically detected.'),
'#required' => TRUE,
);
}
// File settings.
$form['files'] = array(
'#type' => 'fieldset',
'#title' => t('File settings'),
);
$form['files']['search_file_attachments_include'] = array(
'#type' => 'textfield',
'#title' => t('Included file extensions or mimetypes'),
'#description' => t('A comma-separated list of file extensions or mimetypes that will be included to the file search index.'),
'#default_value' => $config
->get('files.include'),
'#required' => TRUE,
);
// Advanced settings.
$form['advanced'] = array(
'#type' => 'details',
'#title' => t('Advanced settings'),
'#open' => FALSE,
);
$form['advanced']['search_file_attachments_debug'] = array(
'#type' => 'checkbox',
'#title' => t('Activate Debugging'),
'#description' => t('Activate this option only for development and not on production sites.'),
'#default_value' => $config
->get('debug'),
);
return parent::buildForm($form, $form_state);
}