Commit 62151fc9 authored by merlinofchaos's avatar merlinofchaos

#281555: Add row classes (first, last, even, odd, row number) to the unformatted and list styles.

parent 455d2315
......@@ -21,6 +21,5 @@ class views_plugin_style_default extends views_plugin_style {
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
// @todo -- separator option
}
}
......@@ -405,6 +405,25 @@ function template_preprocess_views_view_grid(&$vars) {
$vars['rows'] = $rows;
}
/**
* Display the simple view of rows one after another
*/
function template_preprocess_views_view_unformatted(&$vars) {
$view = $vars['view'];
$rows = $vars['rows'];
$vars['classes'] = array();
// Set up striping values.
foreach ($rows as $id => $row) {
$vars['classes'][$id] = 'views-row-' . ($id + 1);
$vars['classes'][$id] .= ' views-row-' . ($id % 2 ? 'even' : 'odd');
if ($id == 0) {
$vars['classes'][$id] .= ' views-row-first';
}
}
$vars['classes'][$id] .= ' views-row-last';
}
/**
* Preprocess an RSS feed
*/
......
......@@ -14,8 +14,8 @@
<h3><?php print $title; ?></h3>
<?php endif; ?>
<<?php print $options['type']; ?>>
<?php foreach ($rows as $row): ?>
<li><?php print $row ?></li>
<?php foreach ($rows as $id => $row): ?>
<li class="<?php print $classes[$id]; ?>"><?php print $row; ?></li>
<?php endforeach; ?>
</<?php print $options['type']; ?>>
</div>
\ No newline at end of file
......@@ -10,6 +10,8 @@
<?php if (!empty($title)): ?>
<h3><?php print $title; ?></h3>
<?php endif; ?>
<?php foreach ($rows as $row): ?>
<?php print $row ?>
<?php foreach ($rows as $id => $row): ?>
<div class="<<?php print $classes[$id]; ?>">
<?php print $row; ?>
</div>
<?php endforeach; ?>
\ No newline at end of file
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