Closed (fixed)
Project:
Views (for Drupal 7)
Version:
7.x-3.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
12 Jan 2010 at 22:16 UTC
Updated:
20 Sep 2010 at 18:00 UTC
Jump to comment: Most recent file
Comments
Comment #1
merlinofchaos commentedCan we do the same for the major styles? In particular I think the unformatted style wants it, and the fields row style wants this?
Comment #2
jacineSure, why not ;)
Comment #3
jacineHey, sorry for the delay here. I did the unformatted style, but the fields were a little hairy because the label and the field wrapper class are both using the
$field->classvariable. I played with it a little, but think what you have now is better in the end.<<?php print $field->inline_html;?> class="views-field-<?php print $field->class; ?>"><label class="views-label-<?php print $field->class; ?>">Note: the template file for views-view-unformatted.tpl.php didn't need any changes, since it's already printing
$classes[$id].If you wanted more/something else, let me know :)
Comment #4
johnalbinsubscribe.
Comment #5
dawehnerThere is another patch for the table which does the imploting in the template file. Which one is better?
implode in preprocess
implode in template file
Comment #6
jacine@dereine preprocess is better. It makes for a cleaner template file.
Comment #7
merlinofchaos commentedThis patch needs to update the documentation at hte top of the template to reflect that the variables available have changed.
Also, I think this is a little too aggressive in removing stuff. $name is a useful variable to have, as is $display_id -- those shouldn't be removed.
Comment #8
jacineHow's this?
Comment #9
merlinofchaos commentedCommitted to all branches! Thanks!
Comment #10
jacineYay! Thank you :D
Comment #11
jcmarco commentedLast patch breaks any unformatted view.
The template_preprocess_views_view_unformatted() function is using $vars['classes_array'] as an internal temporal array to build up the $vars['classes'],
only $classes[$id] are used in the template to define classes for every row div in the views-views-unformatted.tpl.php.
The problem is that $vars['classes_array'] is left there and the Zen theme or any D7 theme (http://api.lullabot.com/template_process/7) ,
transform every $vars['classes_array'] in a $vars['classes'] so it is trying to apply a $vars['classes'] = implode(' ', $vars['classes_array']);
but the $vars['classes_array'] is a multidimensional array, so you find in the html code than every unformatted views has on each row the next classes:
first row: 'A', second: 'r', third:'r'...'a'..... (guess next?)
This patch use a temporal array for building the $vars['classes'][$id]
Comment #12
karens commentedLinking to a similar issue in the D7 version. It may be that that fix (or a variation) will work here. See #753808: Notice: Array to string conversion in template_process().
Comment #13
merlinofchaos commentedCommitted to 6.x; needs porting to 7.x
Comment #14
dawehnerThis kind of code is already in d7.