summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.txt3
-rw-r--r--theme/theme.inc4
-rw-r--r--theme/views-view-table.tpl.php8
3 files changed, 11 insertions, 4 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index b7f662e..ab7e6ca 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -99,4 +99,5 @@ Views 2.3
o #343047 by alienbrain: Allow all handlers to participate in view validation.
o #339223 by greggles: Allow taxonomy term tid to be sortable.
o #324378 by eigentor: CSS improvements to the view list page.
- o #354736 by Shai: Clarification on exposed filter text. \ No newline at end of file
+ o #354736 by Shai: Clarification on exposed filter text.
+ o #364637 by moshe and dww: Allow preprocessors to add row classes to table style. \ No newline at end of file
diff --git a/theme/theme.inc b/theme/theme.inc
index ec7134f..b9b0f5e 100644
--- a/theme/theme.inc
+++ b/theme/theme.inc
@@ -353,6 +353,10 @@ function template_preprocess_views_view_table(&$vars) {
}
}
+ foreach ($vars['rows'] as $num => $row) {
+ $vars['row_classes'][$num][] = ($num % 2 == 0) ? 'odd' : 'even';
+ }
+
$vars['class'] = 'views-table';
if (!empty($options['sticky'])) {
drupal_add_js('misc/tableheader.js');
diff --git a/theme/views-view-table.tpl.php b/theme/views-view-table.tpl.php
index c8440e6..8a622b7 100644
--- a/theme/views-view-table.tpl.php
+++ b/theme/views-view-table.tpl.php
@@ -8,8 +8,10 @@
* - $header: An array of header labels keyed by field id.
* - $fields: An array of CSS IDs to use for each field id.
* - $class: A class or classes to apply to the table, based on settings.
- * - $rows: An array of row items. Each row is an array of content
- * keyed by field ID.
+ * - $row_classes: An array of classes to apply to each row, indexed by row
+ * number. This matches the index in $rows.
+ * - $rows: An array of row items. Each row is an array of content.
+ * $rows are keyed by row number, fields within rows are keyed by field ID.
* @ingroup views_templates
*/
?>
@@ -28,7 +30,7 @@
</thead>
<tbody>
<?php foreach ($rows as $count => $row): ?>
- <tr class="<?php print ($count % 2 == 0) ? 'odd' : 'even';?>">
+ <tr class="<?php print implode(' ', $row_classes[$count]); ?>">
<?php foreach ($row as $field => $content): ?>
<td class="views-field views-field-<?php print $fields[$field]; ?>">
<?php print $content; ?>