I have a section Events
with a matrix field (let's call it dates
). The matrix features a single block type with a single date
field. One Event
can have multiple dates. Think theatre plays with multiple show dates.
Now I'd like to create a list of all events, ordered by the date
field. This means that the same entry could show multiple times in the list (once for each date
in the matrix field). I want to query all future dates in the matrix, fetch related entries, limit the number of items displayed and support pagination.
Ideally there is something like craft.entries
but for matrix fields.
Example
The following example shows three different Event
entries, ordered by their date
s. Notice how the same entry can appear multiple times.
- 14/12/01 @8pm - The Great Gatsby (ID #1)
- 14/12/01 @8pm - Moby Dick (ID #2)
- 14/12/02 @3pm - Snow White (ID #3)
- 14/12/02 @5pm - Snow White (ID #3)
- 15/12/05 @7pm - The Great Gatsby (ID #1)
Can anyone point me in the right direction? I'm not afraid to dive into plugin development (already created a simple "Address" field type with geocoding support) but is there an easier way? Thanks for your time!