function search_files_helper_edit_form in Search Files 7.2
Form callback for adding/editing a file helper.
1 string reference to 'search_files_helper_edit_form'
- search_files_edit in ./
search_files.module - Edits or adds a helper.
File
- ./
search_files.module, line 333 - Organizes and provides helper functions for extracting text from files.
Code
function search_files_helper_edit_form($form, &$form_state, $values = array()) {
$values += array(
'name' => t('Sample extractor'),
'extension' => 'foo',
'helper_path' => '/opt/bin/foo-extract %file%',
'id' => 0,
);
$form['search_files_name'] = array(
'#type' => 'textfield',
'#title' => t('Helper name'),
'#size' => 50,
'#maxlength' => 50,
'#default_value' => $values['name'],
'#required' => TRUE,
'#description' => t('A name for this helper configuration.'),
);
$form['search_files_extension'] = array(
'#type' => 'textfield',
'#title' => t('Extension'),
'#size' => 10,
'#maxlength' => 10,
'#default_value' => $values['extension'],
'#required' => TRUE,
'#description' => t('Enter the extension for the files that you want the helper application to process. Do not include the period.'),
);
$form['search_files_helper_path'] = array(
'#type' => 'textfield',
'#title' => t('Helper path'),
'#size' => 100,
'#maxlength' => 255,
'#default_value' => $values['helper_path'],
'#validate' => array(
'search_files_helpers_validate_add_edit' => array(),
),
'#required' => TRUE,
'#description' => t('Enter the path to the helper application installed on your server. "%file%" is a placeholder for the path of the attachment file and is required. Include any command-line parameters as well (for example, pdftotext requires a - after the file to be processed).'),
);
if ($values['id']) {
// editing existing
$form['search_files_id'] = array(
'#type' => 'value',
'#value' => $values['id'],
);
$form['submit_done'] = array(
'#type' => 'submit',
'#value' => t('Update'),
);
}
else {
// adding a new one
$form['submit_done'] = array(
'#type' => 'submit',
'#value' => t('Save and done'),
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save and add another'),
);
$form['#validate'][] = 'search_files_helper_add_form_validate';
}
return $form;
}