diff options
-rw-r--r-- | mass_image_import.module | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/mass_image_import.module b/mass_image_import.module index 5fe82e5..5bcf731 100644 --- a/mass_image_import.module +++ b/mass_image_import.module @@ -76,10 +76,24 @@ function mass_image_import_types() { } /** + * Implementation of hook_validate(). + */ +function mass_image_import_form_validate($form, $form_state) { + if (!isset($form_state['values']['node_type'])) { + form_set_error('node_type', t('Please choose a content type')); + } + else { + $type = $form_state['values']['node_type']; + $types = node_get_types(); + + if (!isset($types[$type])) { + form_set_error('node_type', t('Invalid content type')); + } + } +} + +/** * Handle post-validation form-submission. - * - * @todo - * Validation. */ function mass_image_import_form_submit($form, &$form_state) { // Save form input. |