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
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 1073422-fusion-teaser-class.patch | 1.03 KB | ezra-g |
| fusion_core_template.php_.patch | 1.09 KB | gram.steve |
Comments
Comment #1
pcarman commentedSecond.
Comment #2
gram.steve commentedSorry, 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:
Comment #3
ezra-g commentedI 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.
Comment #4
coltraneThis was fixed in http://drupalcode.org/project/fusion.git/commit/f67220d