Commit a25b6054 authored by Dries's avatar Dries

- Patch #721754 by Shellingfox, lotyrin, Damien Tournoud, chx, hefox, Gábor...

- Patch #721754 by Shellingfox, lotyrin, Damien Tournoud, chx, hefox, Gábor Hojtsy, puregin: a node cannot be displayed in different view mode on its own page.
parent 30ecab37
...@@ -67,7 +67,7 @@ function blog_form($node, $form_state) { ...@@ -67,7 +67,7 @@ function blog_form($node, $form_state) {
* Implements hook_view(). * Implements hook_view().
*/ */
function blog_view($node, $view_mode) { function blog_view($node, $view_mode) {
if (node_is_page($node)) { if ($view_mode == 'full' && node_is_page($node)) {
// Breadcrumb navigation. // Breadcrumb navigation.
drupal_set_breadcrumb(array(l(t('Home'), NULL), l(t('Blogs'), 'blog'), l(t("!name's blog", array('!name' => format_username($node))), 'blog/' . $node->uid))); drupal_set_breadcrumb(array(l(t('Home'), NULL), l(t('Blogs'), 'blog'), l(t("!name's blog", array('!name' => format_username($node))), 'blog/' . $node->uid)));
} }
......
...@@ -91,7 +91,7 @@ function book_node_view_link($node, $view_mode) { ...@@ -91,7 +91,7 @@ function book_node_view_link($node, $view_mode) {
$links = array(); $links = array();
if (isset($node->book['depth'])) { if (isset($node->book['depth'])) {
if ($view_mode == 'full') { if ($view_mode == 'full' && node_is_page($node)) {
$child_type = variable_get('book_child_type', 'book'); $child_type = variable_get('book_child_type', 'book');
if ((user_access('add content to books') || user_access('administer book outlines')) && node_access('create', $child_type) && $node->status == 1 && $node->book['depth'] < MENU_MAX_DEPTH) { if ((user_access('add content to books') || user_access('administer book outlines')) && node_access('create', $child_type) && $node->status == 1 && $node->book['depth'] < MENU_MAX_DEPTH) {
$links['book_add_child'] = array( $links['book_add_child'] = array(
......
...@@ -698,7 +698,7 @@ function comment_node_view($node, $view_mode) { ...@@ -698,7 +698,7 @@ function comment_node_view($node, $view_mode) {
// page. We compare $node and $page_node to ensure that comments are not // page. We compare $node and $page_node to ensure that comments are not
// appended to other nodes shown on the page, for example a node_reference // appended to other nodes shown on the page, for example a node_reference
// displayed in 'full' view mode within another node. // displayed in 'full' view mode within another node.
if ($node->comment && node_is_page($node) && empty($node->in_preview) && user_access('access comments')) { if ($node->comment && $view_mode == 'full' && node_is_page($node) && empty($node->in_preview) && user_access('access comments')) {
$node->content['comments'] = comment_node_page_additions($node); $node->content['comments'] = comment_node_page_additions($node);
} }
} }
......
...@@ -277,7 +277,7 @@ function forum_node_view($node, $view_mode) { ...@@ -277,7 +277,7 @@ function forum_node_view($node, $view_mode) {
$vid = variable_get('forum_nav_vocabulary', 0); $vid = variable_get('forum_nav_vocabulary', 0);
$vocabulary = taxonomy_vocabulary_load($vid); $vocabulary = taxonomy_vocabulary_load($vid);
if (_forum_node_check_node_type($node)) { if (_forum_node_check_node_type($node)) {
if (node_is_page($node)) { if ($view_mode == 'full' && node_is_page($node)) {
// Breadcrumb navigation // Breadcrumb navigation
$breadcrumb[] = l(t('Home'), NULL); $breadcrumb[] = l(t('Home'), NULL);
$breadcrumb[] = l($vocabulary->name, 'forum'); $breadcrumb[] = l($vocabulary->name, 'forum');
......
...@@ -1155,7 +1155,7 @@ function hook_validate($node, &$form) { ...@@ -1155,7 +1155,7 @@ function hook_validate($node, &$form) {
* @ingroup node_api_hooks * @ingroup node_api_hooks
*/ */
function hook_view($node, $view_mode) { function hook_view($node, $view_mode) {
if (node_is_page($node)) { if ($view_mode == 'full' && node_is_page($node)) {
$breadcrumb = array(); $breadcrumb = array();
$breadcrumb[] = l(t('Home'), NULL); $breadcrumb[] = l(t('Home'), NULL);
$breadcrumb[] = l(t('Example'), 'example'); $breadcrumb[] = l(t('Example'), 'example');
......
...@@ -1222,7 +1222,7 @@ function node_view($node, $view_mode = 'full') { ...@@ -1222,7 +1222,7 @@ function node_view($node, $view_mode = 'full') {
// displayed on its own page. Modules may alter this behavior (for example, // displayed on its own page. Modules may alter this behavior (for example,
// to restrict contextual links to certain view modes) by implementing // to restrict contextual links to certain view modes) by implementing
// hook_node_view_alter(). // hook_node_view_alter().
if (!empty($node->nid) && !node_is_page($node)) { if (!empty($node->nid) && !($view_mode == 'full' && node_is_page($node))) {
$build['#contextual_links']['node'] = array('node', array($node->nid)); $build['#contextual_links']['node'] = array('node', array($node->nid));
} }
...@@ -1355,7 +1355,7 @@ function template_preprocess_node(&$variables) { ...@@ -1355,7 +1355,7 @@ function template_preprocess_node(&$variables) {
$uri = entity_uri('node', $node); $uri = entity_uri('node', $node);
$variables['node_url'] = url($uri['path'], $uri['options']); $variables['node_url'] = url($uri['path'], $uri['options']);
$variables['title'] = check_plain($node->title); $variables['title'] = check_plain($node->title);
$variables['page'] = node_is_page($node); $variables['page'] = $variables['view_mode'] == 'full' && node_is_page($node);
if (!empty($node->in_preview)) { if (!empty($node->in_preview)) {
unset($node->content['links']); unset($node->content['links']);
......
...@@ -637,7 +637,7 @@ function template_preprocess_taxonomy_term(&$variables) { ...@@ -637,7 +637,7 @@ function template_preprocess_taxonomy_term(&$variables) {
$uri = entity_uri('taxonomy_term', $term); $uri = entity_uri('taxonomy_term', $term);
$variables['term_url'] = url($uri['path'], $uri['options']); $variables['term_url'] = url($uri['path'], $uri['options']);
$variables['term_name'] = check_plain($term->name); $variables['term_name'] = check_plain($term->name);
$variables['page'] = taxonomy_term_is_page($term); $variables['page'] = $variables['view_mode'] == 'full' && taxonomy_term_is_page($term);
// Flatten the term object's member fields. // Flatten the term object's member fields.
$variables = array_merge((array) $term, $variables); $variables = array_merge((array) $term, $variables);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment