From 61740bd8ee133c3d0ea2543bccc4d00a62c9e3a0 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Fri, 23 Sep 2005 08:47:13 +0000 Subject: - Patch #10056: allow the node title forms to be customized. --- modules/node.module | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'modules/node.module') diff --git a/modules/node.module b/modules/node.module index 3a17febf5..586ffafba 100644 --- a/modules/node.module +++ b/modules/node.module @@ -1242,13 +1242,6 @@ function node_validate($node) { // Convert the node to an object, if necessary. $node = array2object($node); - // Validate the title field. - if (isset($node->title)) { - if (trim($node->title) == '') { - form_set_error('title', t('You have to specify a title.')); - } - } - // Make sure the body has the minimum number of words. // todo use a better word counting algorithm that will work in other languages if (isset($node->body) && count(explode(' ', $node->body)) < variable_get('minimum_'. $node->type .'_size', 0)) { @@ -1324,6 +1317,16 @@ function node_validate($node) { return $node; } +/** + * Validate the title of a node + */ +function node_validate_title($node, $message = NULL) { + // Validate the title field. + if (trim($node->title) == '') { + form_set_error('title', isset($message) ? $message : t('You have to specify a title.')); + } +} + /** * Generate the node editing form. */ @@ -1378,9 +1381,8 @@ function node_form($edit) { $output .= $extras ? '
'. $extras .'
' : ''; } - // Add the default fields. + // Open the enclosing div. $output .= '
'; - $output .= form_textfield(t('Title'), 'title', $edit->title, 60, 128, NULL, NULL, TRUE); // Add the node-type-specific fields. $output .= $form; -- cgit v1.2.3