If the view-grid has an attribute containing class, the class is property is printed twice, as in the following HTML excerpt:
<table class="views-view-grid cols-3" class="views-view-grid">
The code responsible for this is in views/theme/theme.inc and views/theme/views-view-grid.tpl.php.
views/theme/theme.inc, line 761:
$vars['class'] = 'views-view-grid cols-' . $columns;
views/theme/views-view-grid.tpl.php, line 16:
<table class="<?php print $class;
" print $attributes; >
?>
I am guessing there should be a check as to whether the $attributes string contains class, in which case the $class string should not be printed beforehand.
Comments
Comment #1
Sivert commentedSuggested patch: Remove class="
print $class;from template, since$attributesis the default container of class, as I understand it.Comment #2
dawehnerOh removing something is probably bad. People might assume it exists for their custom templates.
what about checking the attributes class in the prepocess or in a process function?
Comment #3
damiankloip commentedDo you have exact step to reproduce this? I can't reproduce this at the moment. I agree with #2 though, if we need to fix this, it should be done outside of the template.
Comment #4
dawehner.
Comment #5
lorisbel commentedYou can reproduce the bug simple creating a new view and choosing 2x2 grid layout.
Comment #6
lorisbel commentedHere is a quick patch, please test it. I suggests to remove $attribute againt of $class, because the content of $attributes is included in $class variable.
Comment #7
damiankloip commentedAs dawehner mentioned in #2, any patches will probably need to be using the process/preprocess functions to manage this instead.
Comment #8
dawehnerAlso printing the title twice doesn't seem to be what you expect.
Comment #9
treckstar commentedI stumbled into this error while validating my site as XHTML. Using Views 3 stable release, Omega Theme, and a lot of other modifications...
Unlike the original post, I was using a Views Table format, and the class was repeated twice.
I solved this quickly by overriding the views template for the table format, and deleted the print $attributes.
I know this is not the most ideal way, but I was not selecting any of the "table" element classes anyways.
Minor issue and easy fix.
Comment #10
fox mulder commented#9: I think so the $attributes variable can contain any other attribute like class, so it's not recommended to delete it. My suggestion is the following code in template.php:
Comment #11
dadderley commentedThanks fox mulder.
I am using an Omega subtheme.
This cleared up this annoying problem.