I am working on my first craft project and am wondering how to create the following data structure:
I have a page with a large archive of solo-events (lectures, discussions etc). I think I will use a channel with categories for this.
In addition, there is a second content type: a conference. A conference is a group of solo-events. For example, several lectures and discussions.
The conference as a container has certain fields (picture, text) and the solo-events have other fields (speakers for example).
I wonder what is the best way in Craft to enable this form of container.
Example:
Solo-Events:
- Event 1 with Speaker a
- Event 2 with Speaker b
…
Conferences:
- Conference A
-- Event A1 with Speaker c
-- Event A2 with Speaker d
- Conference B
-- Event B1 with Speaker e
-- Event B2 with Speaker f
…
In the Frontend I would like to have:
Speakers-Archive: I think this will be the easy one. For the speaker I would like to work with a channel and link them to the events.
Solo-Events and Conference-Archive:
A list with all solo-events and all conferences but without the sub-events. So, this list should contain: Event 1, Event 2, Conference A, Conference B (A1, A2, B1, B2 should be excluded)
I am wondering how to deal with this idea of grouping the events to conferences:
I was thinking:
Two channels, events and conferences.
All events (solo and conference-related) are in one channel. For a conference (second channel) I can select the events which I want to include. For the archive list I need to exclude all the solo-events that are part of conferences. This may not be optimal in terms of performance and user experience in the backend
Structure for Confernces and a Channel for Solo-Events
The conferences are the parent elements, the solo events are the child elements. But how can I create different fields for the parents and children?
Structure with Entry Types:
I wonder if i can work with entry type here as well. But But how can I bring the Entry Type together with the Hierarchy? So that Parent is always a conference and a children is an Event?
Matrix Field:
The Conferences has a matrix field to store the individual events. But I dont like this approach because I think it would be hard to get all the speaker from a conferences matrix field and combine them with the speaker from the solo-events to get one list with all speaker
Categories.
all events are stored in one channel and I create a Categorie for the Conferences. It feels kind of wrong-headed because the Conference (in my understanding) is the parent of the event rather than the category.
What do you think?
At the moment I am trying the second approach:
{# get all conferences (parents) (level =1 ) from a structure and merge with all solo-events from a channel#}
{% set entriesConferences = craft.entries.section('conferences').level(1).ids() %}
{% set entriesEvents = craft.entries.section(['events']).ids() %}
{# Combine those IDs #}
{% set entryIdsCombined = entriesConferences | merge(entriesEvents) %}
{# Get all entries (so, no IDs this time), using your IDs, order by date#}
{% set allEntries = craft.entries.id(entryIdsCombined).order('datumUhrzeit desc') %}
Is there a better (in terms of performance, scalability and user experience in the backend) way to archive this?
I asked this question Oli from the craft team and he gave me an answer that he will hopefully add here as well.
Thanks!