blob: 1ad3227ffdc7f17b7f7438978639362297ece2fe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
<?php
// $Id$
/**
* @file
* Dummy module implementing node related hooks to test API interaction with
* the Node module.
*/
/**
* Implementation of hook_node_view().
*/
function node_test_node_view($node, $teaser) {
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>',
);
}
}
|