diff --git a/src/components/EventList.js b/src/components/EventList.js
index d023421..05b8a71 100644
--- a/src/components/EventList.js
+++ b/src/components/EventList.js
@@ -171,6 +171,10 @@ export const pageQuery = graphql`
slug
path
description
+ association {
+ title
+ path
+ }
}
}
fragment EventListFields on wordpress__wp_events {
diff --git a/src/templates/event.js b/src/templates/event.js
index fd88182..4c15979 100644
--- a/src/templates/event.js
+++ b/src/templates/event.js
@@ -34,6 +34,7 @@ export const EventTemplate = ({
priceStudent,
priceRegular,
eventTypes,
+ organizers,
}) => {
const hasFeaturedMedia = featuredMedia && !!featuredMedia.localFile
return (
@@ -117,6 +118,18 @@ export const EventTemplate = ({
)}
+ {organizers && (
+
+
+ {organizers.length === 1 ? 'Arrangør' : 'Arrangører'}
+
+ {organizers.map(organizer => (
+
+ {organizer.name}
+
+ ))}
+
+ )}
{
@@ -159,6 +180,7 @@ const Event = ({ data }) => {
priceStudent={event.price_member}
priceRegular={event.price_regular}
eventTypes={event.event_types}
+ organizers={event.event_organizers}
/>
)
diff --git a/src/wordpress.js b/src/wordpress.js
index 89c62a2..d6bedf7 100644
--- a/src/wordpress.js
+++ b/src/wordpress.js
@@ -61,6 +61,27 @@ const mapEventsToEventOrganizers = entities => {
})
}
+const mapEventOrganizersToAssociations = entities => {
+ const associations = entities.filter(
+ e => e.__type === 'wordpress__wp_associations'
+ )
+
+ return entities.map(e => {
+ if (e.__type !== 'wordpress__wp_event_organizers') {
+ return e
+ }
+ // Replace venue IDs with links to their nodes.
+ const associationId = e.association_id
+ if (associationId !== null) {
+ e.association___NODE = associations.find(
+ obj => associationId === obj.wordpress_id
+ ).id
+ }
+ delete e.association_id
+ return e
+ })
+}
+
const mapEventsToVenues = entities => {
const venues = entities.filter(e => e.__type === 'wordpress__wp_venues')
@@ -87,6 +108,7 @@ const neufNormalizer = ({ entities }) => {
entities = decodeTitles(entities)
entities = mapEventsToEventTypes(entities)
entities = mapEventsToEventOrganizers(entities)
+ entities = mapEventOrganizersToAssociations(entities)
entities = mapEventsToVenues(entities)
return entities
}