Preprocess functions breaks default views unformatted view output - variable collision

larowlan - August 13, 2009 - 06:16
Project:960 Robots
Version:6.x-2.0
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

Hi
The default unformatted view tpl file for views uses a variable named classes (views-view-unformatted.tpl.php).
This is an array of classes for each row, typically an array of the form (views-row views-row-1 views-row-odd views-row-first, views-row views-row-2 views-row-even etc).
The generic preprocess function in ninesixty robots overrides this.
From line 55:

function ninesixtyrobots_preprocess(&$vars, $hook) {
        $vars['classes'] = $hook;
}

Changing this to be slightly more selective (see below) prevents the override for any views template reliant on the classes variable (there are a few):
function ninesixtyrobots_preprocess(&$vars, $hook) {
    if(substr($hook, 0, 4) != 'view') {
        $vars['classes'] = $hook;
    }
}

#1

add1sun - August 13, 2009 - 11:23
Status:needs review» fixed

That function has actually been removed in the latest release since it was originally included for demo purposes only. :-)

#2

System Message - August 27, 2009 - 11:30
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.