summaryrefslogtreecommitdiff
path: root/modules/taxonomy/taxonomy.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2008-12-18 23:07:50 +0000
committerDries Buytaert <dries@buytaert.net>2008-12-18 23:07:50 +0000
commiteb9aefe8b599feb896339b13ba19e5faf3906b23 (patch)
treee8e51c321a2b69cacfdc05e2f9c3dbe3225c0015 /modules/taxonomy/taxonomy.module
parent8a48acb0b26879d45cfacc8f5dda9936eb44e02d (diff)
downloadbrdo-eb9aefe8b599feb896339b13ba19e5faf3906b23.tar.gz
brdo-eb9aefe8b599feb896339b13ba19e5faf3906b23.tar.bz2
- Patch #344361 by Rob Loach, recidive: remove some cruft left from the de-op nodeapi patch.
Diffstat (limited to 'modules/taxonomy/taxonomy.module')
-rw-r--r--modules/taxonomy/taxonomy.module91
1 files changed, 33 insertions, 58 deletions
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module
index 219451cfb..53963fd10 100644
--- a/modules/taxonomy/taxonomy.module
+++ b/modules/taxonomy/taxonomy.module
@@ -654,30 +654,11 @@ function taxonomy_node_get_terms($node, $key = 'tid') {
}
/**
- * Make sure incoming vids are free tagging enabled.
- */
-function taxonomy_node_validate(&$node) {
- if (!empty($node->taxonomy)) {
- $terms = $node->taxonomy;
- if (!empty($terms['tags'])) {
- foreach ($terms['tags'] as $vid => $vid_value) {
- $vocabulary = taxonomy_vocabulary_load($vid);
- if (empty($vocabulary->tags)) {
- // see form_get_error $key = implode('][', $element['#parents']);
- // on why this is the key
- form_set_error("taxonomy][tags][$vid", t('The %name vocabulary can not be modified in this way.', array('%name' => $vocabulary->name)));
- }
- }
- }
- }
-}
-
-/**
* Save term associations for a given node.
*/
function taxonomy_node_save($node, $terms) {
- taxonomy_node_delete_revision($node);
+ taxonomy_nodeapi_delete_revision($node);
// Free tagging vocabularies do not send their tids in the form,
// so we'll detect them here and process them independently.
@@ -736,20 +717,6 @@ function taxonomy_node_save($node, $terms) {
}
/**
- * Remove associations of a node to its terms.
- */
-function taxonomy_node_delete($node) {
- db_query('DELETE FROM {term_node} WHERE nid = %d', $node->nid);
-}
-
-/**
- * Remove associations of a node to its terms.
- */
-function taxonomy_node_delete_revision($node) {
- db_query('DELETE FROM {term_node} WHERE vid = %d', $node->vid);
-}
-
-/**
* Implementation of hook_node_type().
*/
function taxonomy_node_type($op, $info) {
@@ -1372,43 +1339,64 @@ function taxonomy_nodeapi_update($node) {
/**
* Implementation of hook_nodeapi_delete().
+ *
+ * Remove associations of a node to its terms.
*/
function taxonomy_nodeapi_delete($node) {
- taxonomy_node_delete($node);
+ db_query('DELETE FROM {term_node} WHERE nid = %d', $node->nid);
}
/**
* Implementation of hook_nodeapi_delete_revision().
+ *
+ * Remove associations of a node to its terms.
*/
function taxonomy_nodeapi_delete_revision($node) {
- taxonomy_node_delete_revision($node);
+ db_query('DELETE FROM {term_node} WHERE vid = %d', $node->vid);
}
/**
* Implementation of hook_nodeapi_validate().
+ *
+ * Make sure incoming vids are free tagging enabled.
*/
function taxonomy_nodeapi_validate($node, $form) {
- taxonomy_node_validate($node);
+ if (!empty($node->taxonomy)) {
+ $terms = $node->taxonomy;
+ if (!empty($terms['tags'])) {
+ foreach ($terms['tags'] as $vid => $vid_value) {
+ $vocabulary = taxonomy_vocabulary_load($vid);
+ if (empty($vocabulary->tags)) {
+ // see form_get_error $key = implode('][', $element['#parents']);
+ // on why this is the key
+ form_set_error("taxonomy][tags][$vid", t('The %name vocabulary can not be modified in this way.', array('%name' => $vocabulary->name)));
+ }
+ }
+ }
+ }
}
/**
* Implementation of hook_nodeapi_rss_item().
+ *
+ * Provides category information for RSS feeds.
*/
function taxonomy_nodeapi_rss_item($node) {
- return taxonomy_rss_item($node);
+ $output = array();
+ foreach ($node->taxonomy as $term) {
+ $output[] = array(
+ 'key' => 'category',
+ 'value' => check_plain($term->name),
+ 'attributes' => array('domain' => url(taxonomy_term_path($term), array('absolute' => TRUE))),
+ );
+ }
+ return $output;
}
/**
* Implementation of hook_nodeapi_update_index().
*/
function taxonomy_nodeapi_update_index($node) {
- return taxonomy_node_update_index($node);
-}
-
-/**
- * Implementation of hook_nodeapi('update_index').
- */
-function taxonomy_node_update_index($node) {
$output = array();
foreach ($node->taxonomy as $term) {
$output[] = $term->name;
@@ -1445,19 +1433,6 @@ function taxonomy_terms_parse_string($str_tids) {
}
/**
- * Provides category information for RSS feeds.
- */
-function taxonomy_rss_item($node) {
- $output = array();
- foreach ($node->taxonomy as $term) {
- $output[] = array('key' => 'category',
- 'value' => check_plain($term->name),
- 'attributes' => array('domain' => url(taxonomy_term_path($term), array('absolute' => TRUE))));
- }
- return $output;
-}
-
-/**
* Implementation of hook_help().
*/
function taxonomy_help($path, $arg) {