From d1ac149899ad224772eef87ef4f2947efa912de5 Mon Sep 17 00:00:00 2001 From: Capi Etheriel Date: Mon, 2 Jan 2012 11:35:03 -0200 Subject: [PATCH] Issue #1154382 by swentel, barraponto: view mode can no longer be changed --- core/modules/comment/comment.module | 1 + core/modules/node/node.module | 8 +++++++- core/modules/taxonomy/taxonomy.module | 2 ++ core/modules/user/user.module | 1 + 4 files changed, 11 insertions(+), 1 deletions(-) diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index e5e636b..e3e17fd 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -991,6 +991,7 @@ function comment_build_content($comment, $node, $view_mode = 'full', $langcode = // Remove previously built content, if exists. $comment->content = array(); + $comment->view_mode = &$view_mode; // Build fields content. field_attach_prepare_view('comment', array($comment->cid => $comment), $view_mode, $langcode); diff --git a/core/modules/node/node.module b/core/modules/node/node.module index 2910e1a..bc3051a 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -1393,6 +1393,7 @@ function node_build_content($node, $view_mode = 'full', $langcode = NULL) { // Remove previously built content, if exists. $node->content = array(); + $node->view_mode = &$view_mode; // The 'view' hook can be implemented to overwrite the default function // to display nodes. @@ -1457,8 +1458,13 @@ function node_show($node, $message = FALSE) { drupal_set_title(t('Revision of %title from %date', array('%title' => $node->title, '%date' => format_date($node->revision_timestamp))), PASS_THROUGH); } + // Check if view mode is set, defaults to 'full' + if (!isset($node->view_mode)) { + $node->view_mode = 'full'; + } + // For markup consistency with other pages, use node_view_multiple() rather than node_view(). - $nodes = node_view_multiple(array($node->nid => $node), 'full'); + $nodes = node_view_multiple(array($node->nid => $node), $node->view_mode); // Update the history table, stating that this user viewed this node. node_tag_new($node); diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module index 09b67ec..dd75473 100644 --- a/core/modules/taxonomy/taxonomy.module +++ b/core/modules/taxonomy/taxonomy.module @@ -761,6 +761,8 @@ function taxonomy_term_view($term, $view_mode = 'full', $langcode = NULL) { $langcode = $GLOBALS['language_content']->language; } + $term->view_mode = &$view_mode; + field_attach_prepare_view('taxonomy_term', array($term->tid => $term), $view_mode, $langcode); entity_prepare_view('taxonomy_term', array($term->tid => $term), $langcode); diff --git a/core/modules/user/user.module b/core/modules/user/user.module index 009a716..d2dcd8f 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -2559,6 +2559,7 @@ function user_build_content($account, $view_mode = 'full', $langcode = NULL) { // Remove previously built content, if exists. $account->content = array(); + $account->view_mode = &$view_mode; // Build fields content. field_attach_prepare_view('user', array($account->uid => $account), $view_mode, $langcode); -- 1.7.5.4