template_preprocess_node adds a class called node-teaser if we're looking at a teaser. Bartik does it when looking at a full node. This is old times, let's always pass the view mode.

Comments

jyve’s picture

Totally agree with the patch above, since Drupal should not focus on having only two view modes (teaser and full), since extra view modes can be created.

Only suggestion I would make is to use view-mode- as the class prefix, so that the view mode class does not overlap with the node type class.

swentel’s picture

Status: Active » Needs review
StatusFileSize
new2.32 KB

True, better patch using view-mode class.

swentel’s picture

Version: 8.x-dev » 7.x-dev
Component: node.module » Bartik theme

Moving this to Bartik for some more discussion.

swentel’s picture

StatusFileSize
new2.48 KB

Actually, with #1051164: Remove unnecessary $variables['submitted'] override in template.php in, we can ditch the preprocess_node completely in bartik. New patch.

moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community

nice to remove bartik special case.

amateescu’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new4.79 KB

I think it would be better to name it node-view-mode-[view_mode], since we are in the node module.

Also, there are a lot of other places that are affected by this change :)

mgifford’s picture

Assigned: swentel » Unassigned
Issue summary: View changes
Status: Needs review » Needs work

No longer applies.

galactus86’s picture

is there a way to do this to add a body class instead of on node?

Status: Needs work » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.