Our Drupal 7 site has a feed of events which are parsed into nodes. Not every event is equally relevant, and they would like a way to selecrt the top five events, sorted chronologically, to appear on a block on the frontpage. They would also like the events to no longer display in the block once the event has passed. They are comfortable using Nodequeues and have requested one be created for this functionality. So far, this is pretty basic stuff and I have created a View which accomplishes this. The tricky part happens when there are less than five upcoming events in the queue. In this case, they would like unselected events to fill out any vacancies in the block of five.
Typically when I create a Nodequeue:
- I create a relationship to the queue
- I sort by position in the queue
- I filter that the event is in the queue.
By removing the sort and filter, and instead sort first by if event is in queue and then by event date, I get the content I desire; when more than five events are selected, it works fine. When no events are selected, it works fine, however when there is a mix; naturally the in queue events are listed first. I would like all five events to be sorted chronologically.
An aside, I'm not certain Nodequeue is even the best way to do this; as the position in the queue implies a hierarchy. A flag could mark selected nodes, or a boolean field on the content type, or a taxonomy term might each be better solutions. I'm open to suggestions.
But first, how can I best properly sort this list?