diff options
author | Dries Buytaert <dries@buytaert.net> | 2001-11-01 22:54:16 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2001-11-01 22:54:16 +0000 |
commit | 4d8b485fad960ea6551111e58f8c59df053b4456 (patch) | |
tree | 51c7738a0ee2d4ac3e63552643de52bab1c41da5 /modules/story.module | |
parent | e205fee081d307ee7a3ef2248fbb3ded7fcf003c (diff) | |
download | brdo-4d8b485fad960ea6551111e58f8c59df053b4456.tar.gz brdo-4d8b485fad960ea6551111e58f8c59df053b4456.tar.bz2 |
- Added error handling support to the <node>_form hook.
Diffstat (limited to 'modules/story.module')
-rw-r--r-- | modules/story.module | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/modules/story.module b/modules/story.module index 66870c076..1829474fb 100644 --- a/modules/story.module +++ b/modules/story.module @@ -39,9 +39,15 @@ function story_help() { <?php } -function story_form($node) { +function story_form($node, $error) { - $output = form_textarea(t("Body"), "body", $node->body, 60, 15, t("Allowed HTML tags") .": ". htmlspecialchars(variable_get("allowed_html", ""))); + if ($node->body) { + if (count(explode(" ", $node->body)) < variable_get("minimum_node_size", 0)) { + $error["body"] = "<div style=\"color: red;\">". t("The body of your story is too short.") ."</div>"; + } + } + + $output = form_textarea(t("Body"), "body", $node->body, 60, 15, $error["body"] ? $error["body"] : t("Allowed HTML tags") .": ". htmlspecialchars(variable_get("allowed_html", ""))); return $output; } |