Commit dcbab232 authored by Dries's avatar Dries
Browse files

- Updated the story module to use the _validate hook.  Fixes bug #2919 reported
  by Jonathan.
parent 00a62647
......@@ -61,32 +61,32 @@ function story_link($type) {
return $links;
}
function story_form(&$node, &$help, &$error) {
if (isset($node->body)) {
function story_validate(&$node) {
/*
** Validate the size of the story:
*/
if (count(explode(" ", $node->body)) < variable_get("minimum_story_size", 0)) {
$error["body"] = "<div class=\"error\">". t("The body of your story is too short.") ."</div>";
}
/*
** Validate the size of the story:
*/
if (isset($node->body) && count(explode(" ", $node->body)) < variable_get("minimum_story_size", 0)) {
print "body : $node->body";
$error["body"] = "<div class=\"error\">". t("The body of your story is too short.") ."</div>";
}
else {
/*
** Carry out some explanation or submission guidelines:
*/
return $error;
}
function story_form(&$node, &$help, &$error) {
$help = variable_get("story_help", "");
/*
** Carry out some explanation or submission guidelines:
*/
}
$help = variable_get("story_help", "");
if (function_exists("taxonomy_node_form")) {
$output .= implode("", taxonomy_node_form("story", $node));
}
$output .= form_textarea(t("Body"), "body", $node->body, 60, 15, $error["body"] ? $error["body"] : form_allowed_tags_text());
return $output;
......
......@@ -61,32 +61,32 @@ function story_link($type) {
return $links;
}
function story_form(&$node, &$help, &$error) {
if (isset($node->body)) {
function story_validate(&$node) {
/*
** Validate the size of the story:
*/
if (count(explode(" ", $node->body)) < variable_get("minimum_story_size", 0)) {
$error["body"] = "<div class=\"error\">". t("The body of your story is too short.") ."</div>";
}
/*
** Validate the size of the story:
*/
if (isset($node->body) && count(explode(" ", $node->body)) < variable_get("minimum_story_size", 0)) {
print "body : $node->body";
$error["body"] = "<div class=\"error\">". t("The body of your story is too short.") ."</div>";
}
else {
/*
** Carry out some explanation or submission guidelines:
*/
return $error;
}
function story_form(&$node, &$help, &$error) {
$help = variable_get("story_help", "");
/*
** Carry out some explanation or submission guidelines:
*/
}
$help = variable_get("story_help", "");
if (function_exists("taxonomy_node_form")) {
$output .= implode("", taxonomy_node_form("story", $node));
}
$output .= form_textarea(t("Body"), "body", $node->body, 60, 15, $error["body"] ? $error["body"] : form_allowed_tags_text());
return $output;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment