function exif_custom_new_map_form_validate in EXIF Custom 7
Form validation callback for exif_custom_new_map_form().
File
- ./
exif_custom.add.inc, line 34 - Form for creating a new mapping.
Code
function exif_custom_new_map_form_validate($form, &$form_state) {
// Check that the name is unique.
$sql = 'SELECT name FROM {exif_custom_maps} WHERE name = :name';
$result = db_query($sql, array(
':name' => $form_state['values']['name'],
))
->rowCount();
if ($result > 0) {
form_set_error('name', t('The name must be unique'));
}
// Verify an example image was uploaded.
if (!isset($_FILES, $_FILES['files'], $_FILES['files']['name'], $_FILES['files']['name']['example_file'])) {
form_set_error('example_file', t('An example file must be provided.'));
}
// @todo Check image is an allowed type.
}