summaryrefslogtreecommitdiff
path: root/modules/node/tests
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/node/tests
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/node/tests')
-rw-r--r--modules/node/tests/node_test.module27
1 files changed, 22 insertions, 5 deletions
diff --git a/modules/node/tests/node_test.module b/modules/node/tests/node_test.module
index d42172b6b..1ad3227ff 100644
--- a/modules/node/tests/node_test.module
+++ b/modules/node/tests/node_test.module
@@ -8,11 +8,28 @@
*/
/**
- * When the module is enabled, text will be added to all nodes in all build modes.
+ * Implementation of hook_node_view().
*/
function node_test_node_view($node, $teaser) {
- $node->content['node_test_extra_field'] = array(
- '#markup' => '<p>' . t('Extra test data added to node !nid.', array('!nid' => $node->nid)) . '</p>',
- '#weight' => 10,
- );
+ if ($node->build_mode == NODE_BUILD_RSS) {
+ // Add RSS elements and namespaces when building the RSS feed.
+ $node->rss_elements[] = array(
+ 'key' => 'testElement',
+ 'value' => t('Value of testElement RSS element for node !nid.', array('!nid' => $node->nid)),
+ );
+ $node->rss_namespaces['xmlns:drupaltest'] = 'http://example.com/test-namespace';
+
+ // Add content that should be displayed only in the RSS feed.
+ $node->content['extra_feed_content'] = array(
+ '#markup' => '<p>' . t('Extra data that should appear only in the RSS feed for node !nid.', array('!nid' => $node->nid)) . '</p>',
+ '#weight' => 10,
+ );
+ }
+
+ if ($node->build_mode != NODE_BUILD_RSS) {
+ // Add content that should NOT be displayed in the RSS feed.
+ $node->content['extra_non_feed_content'] = array(
+ '#markup' => '<p>' . t('Extra data that should appear everywhere except the RSS feed for node !nid.', array('!nid' => $node->nid)) . '</p>',
+ );
+ }
}