We have a couple of views that use node rows and specify teaser styles. IF the nodes in the list do not have body text, they get the class 'full_node' rather than getting the class 'teaser'. This caused us some problems as we rely on this class for things like indentation and some basic formatting.

In Fusion Core, template.php, function fusion_core_preprocess_node() the wrong test is being applied.

At line 160:

$node_classes[] = (isset($vars['node']->teaser)) ? 'teaser' : 'full-node';    // Node is teaser or full-node

The value of the property $node->teaser is being tested with isset. In cases where there is no body text, this can end up null and fail the test.

All node.tpl.php files I have seen test the value of the inbound $teaser request variable passed through from node_view(). This will always be 1 if the node_view request included a teaser.

I modified this line as follows to test on the same parameter:

$node_classes[] = $vars['teaser'] ? 'teaser' : 'full-node';    // Node is teaser or full-node

A patch file is attached

Comments

pcarman’s picture

Second.

gram.steve’s picture

Sorry, but one more note.

The value of $node->teaser is a string that holds the text of the teaser. If the teaser request comes into node_view(), the value of $content is set to be the same. So having it be NULL would be proper behavior for tests like this:

if ($content) { 
  echo $content;
}
ezra-g’s picture

Issue tags: +teaser
StatusFileSize
new1.03 KB

I tested this fix with the Views 'frontpage' view and a node with no body text, and it corrected the classes as expected. +1 for committing.

This patch didn't apply, so I've re-rolled it here.

coltrane’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)
Issue tags: -teaser, -template.php, -classes, -preprocess_node

Automatically closed -- issue fixed for 2 weeks with no activity.