function search_files_helpers_validate_add_edit in Search Files 7.2
Same name and namespace in other branches
- 5 search_files.module \search_files_helpers_validate_add_edit()
- 6.2 search_files.module \search_files_helpers_validate_add_edit()
Validate callback for search_files_helper_add_form field.
File
- ./
search_files.module, line 404 - Organizes and provides helper functions for extracting text from files.
Code
function search_files_helpers_validate_add_edit($field) {
if (!preg_match('/%file%/', $field['#value'])) {
form_set_error($field['#title'], t('"%field" must contain the token %file%', array(
'%field' => $field['#title'],
)));
}
// Check to see if helper app can be found
$helper_file = preg_replace('/\\s.+$/', '', $field['#value']);
if (!file_exists($helper_file)) {
form_set_error($field['#title'], t("Can't find helper app %helper -- please verify it is installed.", array(
'%helper' => $helper_file,
)));
}
}