aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio <silvio@devlet.com.br>2010-10-13 11:41:55 -0300
committerSilvio <silvio@devlet.com.br>2010-10-13 11:41:55 -0300
commitbc0e7da522b389aaccb9239e0a82498e8edbe58b (patch)
treef106548848731a1a48391f7d2ddf19d2d2f16a87
parent79c9a8e8b7df654079fbe093eaf184a8d2963a25 (diff)
downloadmass_image_import-bc0e7da522b389aaccb9239e0a82498e8edbe58b.tar.gz
mass_image_import-bc0e7da522b389aaccb9239e0a82498e8edbe58b.tar.bz2
Adding mass_image_import_form_validate()
-rw-r--r--mass_image_import.module20
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.