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) { ...@@ -61,32 +61,32 @@ function story_link($type) {
return $links; return $links;
} }
function story_form(&$node, &$help, &$error) { function story_validate(&$node) {
if (isset($node->body)) {
/* /*
** Validate the size of the story: ** 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>";
}
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 {
/* return $error;
** Carry out some explanation or submission guidelines: }
*/
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")) { if (function_exists("taxonomy_node_form")) {
$output .= implode("", taxonomy_node_form("story", $node)); $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()); $output .= form_textarea(t("Body"), "body", $node->body, 60, 15, $error["body"] ? $error["body"] : form_allowed_tags_text());
return $output; return $output;
......
...@@ -61,32 +61,32 @@ function story_link($type) { ...@@ -61,32 +61,32 @@ function story_link($type) {
return $links; return $links;
} }
function story_form(&$node, &$help, &$error) { function story_validate(&$node) {
if (isset($node->body)) {
/* /*
** Validate the size of the story: ** 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>";
}
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 {
/* return $error;
** Carry out some explanation or submission guidelines: }
*/
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")) { if (function_exists("taxonomy_node_form")) {
$output .= implode("", taxonomy_node_form("story", $node)); $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()); $output .= form_textarea(t("Body"), "body", $node->body, 60, 15, $error["body"] ? $error["body"] : form_allowed_tags_text());
return $output; 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