summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGábor Hojtsy <gabor@hojtsy.hu>2007-07-01 21:16:09 +0000
committerGábor Hojtsy <gabor@hojtsy.hu>2007-07-01 21:16:09 +0000
commitb33070d1762aa9f29bea0d6b286713dfad3bc461 (patch)
tree36c0c4c851b53335664fd3f24ae51a87c3661dfe
parent4de573cadcafac70aee44638e7251715c17a88dc (diff)
downloadbrdo-b33070d1762aa9f29bea0d6b286713dfad3bc461.tar.gz
brdo-b33070d1762aa9f29bea0d6b286713dfad3bc461.tar.bz2
#152493 by yched, freeman and pwolanin: Minimalistic approach to node rendering styles for D6
-rw-r--r--modules/node/node.module17
1 files changed, 16 insertions, 1 deletions
diff --git a/modules/node/node.module b/modules/node/node.module
index 2d7d19021..5c329ed2d 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -9,6 +9,12 @@
define('NODE_NEW_LIMIT', time() - 30 * 24 * 60 * 60);
+define('NODE_BUILD_NORMAL', 0);
+define('NODE_BUILD_PREVIEW', 1);
+define('NODE_BUILD_SEARCH_INDEX', 2);
+define('NODE_BUILD_SEARCH_RESULT', 3);
+define('NODE_BUILD_RSS', 4);
+
/**
* Implementation of hook_help().
*/
@@ -811,6 +817,12 @@ function node_prepare($node, $teaser = FALSE) {
* of the node's body.
*/
function node_build_content($node, $teaser = FALSE, $page = FALSE) {
+
+ // The build mode identifies the target for which the node is built.
+ if (!isset($node->build_mode)) {
+ $node->build_mode = NODE_BUILD_NORMAL;
+ }
+
// Remove the delimiter (if any) that separates the teaser from the body.
$node->body = isset($node->body) ? str_replace('<!--break-->', '', $node->body) : '';
@@ -989,6 +1001,7 @@ function node_search($op = 'search', $keys = NULL) {
foreach ($find as $item) {
// Build the node body.
$node = node_load($item->sid);
+ $node->build_mode = NODE_BUILD_SEARCH_RESULT;
$node = node_build_content($node, FALSE, FALSE);
$node->body = drupal_render($node->content);
@@ -1935,6 +1948,7 @@ function node_feed($nodes = 0, $channel = array()) {
while ($node = db_fetch_object($nodes)) {
// Load the specified node:
$item = node_load($node->nid);
+ $node->build_mode = NODE_BUILD_RSS;
$link = url("node/$node->nid", array('absolute' => TRUE));
if ($item_length != 'title') {
@@ -2353,7 +2367,7 @@ function node_preview($node) {
// Previewing alters $node so it needs to be cloned.
if (!form_get_errors()) {
$cloned_node = drupal_clone($node);
- $cloned_node->in_preview = TRUE;
+ $cloned_node->build_mode = NODE_BUILD_PREVIEW;
$output = theme('node_preview', $cloned_node);
}
drupal_set_title(t('Preview'));
@@ -2616,6 +2630,7 @@ function node_update_index() {
$node = node_load($node->nid);
// Build the node body.
+ $node->build_mode = NODE_BUILD_SEARCH_INDEX;
$node = node_build_content($node, FALSE, FALSE);
$node->body = drupal_render($node->content);