summaryrefslogtreecommitdiff
path: root/modules/taxonomy.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2004-07-04 16:50:02 +0000
committerDries Buytaert <dries@buytaert.net>2004-07-04 16:50:02 +0000
commitfe2b3e7c006a607c2b9fd9a485a7bda13515a94f (patch)
tree1c16960253df2c99488fdd8cf81305ff369884d4 /modules/taxonomy.module
parent353c05d01536aac26fec7e9cfee0e84838973286 (diff)
downloadbrdo-fe2b3e7c006a607c2b9fd9a485a7bda13515a94f.tar.gz
brdo-fe2b3e7c006a607c2b9fd9a485a7bda13515a94f.tar.bz2
- Patch by Steven and me: refactored the form handling of nodes. The node system is now using form_set_error() and friends like the rest of Drupal does. This makes for both a consistent user experience and consistent code. It simplifies the forms and validation code, however, it does change the node API slightly:
* The _validate hook and the _nodeapi('validate') hook of the node API (1) no longer take an 'error' parameter and (2) should no longer return an error array. To set an error, call form_set_error(). * The _form hook of the node module no longer takes a form hook and should not worry about displaying errors. Ditto for _nodeapi('form_post') and _nodeapi('form_pre').
Diffstat (limited to 'modules/taxonomy.module')
-rw-r--r--modules/taxonomy.module10
1 files changed, 4 insertions, 6 deletions
diff --git a/modules/taxonomy.module b/modules/taxonomy.module
index 8bd8ba1f1..1f18319d0 100644
--- a/modules/taxonomy.module
+++ b/modules/taxonomy.module
@@ -311,7 +311,7 @@ function taxonomy_overview() {
/**
* Generate a form element for selecting terms from a vocabulary.
*/
-function taxonomy_form($vid, $value = 0, $error = array(), $help = NULL, $name = 'taxonomy') {
+function taxonomy_form($vid, $value = 0, $help = NULL, $name = 'taxonomy') {
$vocabulary = taxonomy_get_vocabulary($vid);
$help = ($help) ? $help : $vocabulary->help;
if ($vocabulary->required) {
@@ -321,8 +321,6 @@ function taxonomy_form($vid, $value = 0, $error = array(), $help = NULL, $name =
$blank = '<'. t('none') .'>';
}
- $help .= $error['taxonomy'];
-
return _taxonomy_term_select($vocabulary->name, $name, $value, $vid, $help, intval($vocabulary->multiple), $blank);
}
@@ -350,7 +348,7 @@ function taxonomy_get_vocabularies($type = '', $key = 'vid') {
/**
* Generate a form for selecting terms to associate with a node.
*/
-function taxonomy_node_form($type, $node = '', $error = array(), $help = NULL, $name = 'taxonomy') {
+function taxonomy_node_form($type, $node = '', $help = NULL, $name = 'taxonomy') {
if (!$node->taxonomy) {
if ($node->nid) {
$terms = array_keys(taxonomy_node_get_terms($node->nid));
@@ -365,7 +363,7 @@ function taxonomy_node_form($type, $node = '', $error = array(), $help = NULL, $
$c = db_query("SELECT * FROM {vocabulary} WHERE nodes LIKE '%%%s%%' ORDER BY weight, name", $type);
while ($vocabulary = db_fetch_object($c)) {
- $result[] = taxonomy_form($vocabulary->vid, $terms, $error, $help, $name);
+ $result[] = taxonomy_form($vocabulary->vid, $terms, $help, $name);
}
return $result ? $result : array();
}
@@ -695,7 +693,7 @@ function _taxonomy_term_select($title, $name, $value, $vocabulary_id, $descripti
$size = min(12, count($options));
- return form_item($title, "<select name=\"edit[$name][]\"". ($multiple ? " multiple=\"multiple\" size=\"$size\"" : '') . ($extra ? " $extra" : '') .">$select</select>", $description);
+ return form_item($title, "<select name=\"edit[$name][]\"". ($multiple ? " multiple=\"multiple\" size=\"$size\"" : '') . ($extra ? " $extra" : '') .' class="'. _form_get_class('', false, _form_get_error($name)) ."\">$select</select>", $description, NULL, false, _form_get_error($name));
}
}