Commit 97218fe5 authored by merlinofchaos's avatar merlinofchaos

#451208 by dereine and superbaloo: Fix grid style to not leave missing tds in bottom row.

parent 457e8dee
......@@ -45,6 +45,7 @@ Views 2.x-dev
o #563564 by dereine: Unformatted style does not use options, so the options icon should not appear.
o #564536 by dereine: Node links should allow language setting from node data.
o #551752 by dereine: Clean up row counter code.
o #451208 by dereine and superbaloo: Fix grid style to not leave missing tds in bottom row.
Other changes:
o Implement a post_render hook (for themes too) and cache method.
......
......@@ -399,14 +399,21 @@ function template_preprocess_views_view_grid(&$vars) {
if ($options['alignment'] == 'horizontal') {
$row = array();
$row_count = 0;
foreach ($vars['rows'] as $count => $item) {
$row[] = $item;
$row_count++;
if (($count + 1) % $columns == 0) {
$rows[] = $row;
$row = array();
$row_count = 0;
}
}
if ($row) {
// Fill up the last line.
for ($i = 0; $i < ($columns - $row_count); $i++) {
$row[] = '';
}
$rows[] = $row;
}
}
......@@ -430,6 +437,12 @@ function template_preprocess_views_view_grid(&$vars) {
$remainders--;
}
}
for ($i = 0; $i < count($rows[0]); $i++) {
// This should be string so that's okay :)
if (!isset($rows[count($rows) - 1][$i])) {
$rows[count($rows) - 1][$i] = '';
}
}
}
$vars['rows'] = $rows;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment