Hi,
I have a suggestion for views integration: On the "row plugin", there are already options for specifying alternating view modes for different elements in the result list. (For up to 20 items). Could that option be extended for a more general "even" and "odd" row option?
Let me describe what I'm trying to do:
I have a list of nodes which contain some text and an image. I have created two view modes which use a 2 column layout to put the text and image next to each other into separate columns. One view mode has the image in the left column, the other one in the right column.
Now I would like to create a view which renderes any number of those nodes on one page, rendering the image on the left for all nodes in even rows, and image on the right for all odd rows.
Sorry if this is already possible somehow...
Comments
Comment #1
dooug commentedI think this could be accomplished by using views blocks and the hook_views_pre_render. Another solution might be views_php module, but it is very buggy in D7.
Maybe some odd/even views filter could be rolled into a views plugin? Although the code below probably wouldn't be the best way to accomplish it.
I just had two similar displays and removed odd/even results from each. This is my example from my
template.php(change the ALLCAPS to fit your theme name & views display names)@bforchhammer,
Does that solve your request?
Comment #2
bforchhammer commentedThank you, I haven't tried it but it looks like that might work...
At the moment I'm fine with up to 20 items; just thought it would be nice to have. And isn't the alternating view modes an addition by display suite? If yes it probably shouldn't be too hard to add 'even' and 'odd' classes as well, no?
Comment #3
swentel commentedI'm going to mark this fixed for now. There's an alter possibility now (hook_ds_views_view_mode_alter). While the use case is interesting, I'm going to try and jam in any use case that exists. However, in case suddenly 20 people are interested in this, I'll consider it - even more when a patch would be posted :)
Comment #5
polishyourimage commentedI'm also very interested in this feature.
Comment #6
jawi commentedinterested!
Comment #7
bettibio commentedI'm very interested in this feature.
Comment #8
ja_ca commentedI'd be interested too.
Comment #9
ipwa commentedThere is this recent module: https://www.drupal.org/project/views_parity_row