Make the current view mode available on the node object

Created on 13 November 2011, about 13 years ago
Updated 2 June 2023, over 1 year ago

It's conceivable that in templates you might want to have different display logic depending on if you're looking at something in teaser vs. full vs. search vs. whatever. node_build_content() has the $view_mode passed into it, but it gets thrown away before the $node object gets passed to the template. It'd be trivial to store this as a $node->view_mode property, and in fact that's what #1077602: Convert node.tpl.php to HTML5 is doing in D8.

Since this change doesn't change any APIs and just adds more information on the existing $node object, it should be possible to backport this change to D7.

Postponing on outcome of that issue, since we don't want D7 to get ahead of D8.

Feature request
Status

Closed: duplicate

Version

8.9 ⚰️

Component
Ajax 

Last updated 1 day ago

Created by

🇨🇦Canada webchick Vancouver 🇨🇦

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024