summaryrefslogtreecommitdiff
path: root/modules/taxonomy/taxonomy.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-05-03 10:11:35 +0000
committerDries Buytaert <dries@buytaert.net>2009-05-03 10:11:35 +0000
commita8c30ed91ea00e24f809adc965b05f8292fbc236 (patch)
tree386db65fe5377df5373bf3e2a2b30bf1112a5fc7 /modules/taxonomy/taxonomy.module
parent3d951475eaebab990a78d07acdc344eb50239e18 (diff)
downloadbrdo-a8c30ed91ea00e24f809adc965b05f8292fbc236.tar.gz
brdo-a8c30ed91ea00e24f809adc965b05f8292fbc236.tar.bz2
- Patch #449718 by alienbrain: node_feed() is now using new node building API.
Diffstat (limited to 'modules/taxonomy/taxonomy.module')
-rw-r--r--modules/taxonomy/taxonomy.module55
1 files changed, 27 insertions, 28 deletions
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module
index d38357013..07d970551 100644
--- a/modules/taxonomy/taxonomy.module
+++ b/modules/taxonomy/taxonomy.module
@@ -39,12 +39,28 @@ function taxonomy_theme() {
* An implementation of hook_node_view().
*/
function taxonomy_node_view($node) {
- $links = array();
- // If previewing, the terms must be converted to objects first.
- if (isset($node->build_mode) && $node->build_mode == NODE_BUILD_PREVIEW) {
- $node->taxonomy = taxonomy_preview_terms($node);
+ if (empty($node->taxonomy)) {
+ return;
}
- if (!empty($node->taxonomy)) {
+
+ if ($node->build_mode == NODE_BUILD_RSS) {
+ // Provide category information for RSS feeds.
+ foreach ($node->taxonomy as $term) {
+ $node->rss_elements[] = array(
+ 'key' => 'category',
+ 'value' => $term->name,
+ 'attributes' => array('domain' => url(taxonomy_term_path($term), array('absolute' => TRUE))),
+ );
+ }
+ }
+ else {
+ $links = array();
+
+ // If previewing, the terms must be converted to objects first.
+ if ($node->build_mode == NODE_BUILD_PREVIEW) {
+ $node->taxonomy = taxonomy_preview_terms($node);
+ }
+
foreach ($node->taxonomy as $term) {
// During preview the free tagging terms are in an array unlike the
// other terms which are objects. So we have to check if a $term
@@ -69,13 +85,13 @@ function taxonomy_node_view($node) {
}
}
}
- }
- $node->content['links']['terms'] = array(
- '#type' => 'node_links',
- '#value' => $links,
- '#sorted' => TRUE,
- );
+ $node->content['links']['terms'] = array(
+ '#type' => 'node_links',
+ '#value' => $links,
+ '#sorted' => TRUE,
+ );
+ }
}
/**
@@ -1590,23 +1606,6 @@ function taxonomy_node_validate($node, $form) {
}
/**
- * Implementation of hook_node_rss_item().
- *
- * Provides category information for RSS feeds.
- */
-function taxonomy_node_rss_item($node) {
- $output = array();
- foreach ($node->taxonomy as $term) {
- $output[] = array(
- 'key' => 'category',
- 'value' => $term->name,
- 'attributes' => array('domain' => url(taxonomy_term_path($term), array('absolute' => TRUE))),
- );
- }
- return $output;
-}
-
-/**
* Implementation of hook_node_update_index().
*/
function taxonomy_node_update_index($node) {