I'm currently struggling with the following scenario:

There are two different Content Types:

  • Offer
  • Event

What I want to achieve is this:

There are 6 offers and each of those offers have several events that are nodes as well, in those event nodes there's a field for the date when the event takes place. For example: one of the offers is a photography workshop and I want a section in this node where the dates of the events (as a link to the event node) are listed.

I was thinking about creating a taxonomy with all the offers, whenever a event is created you have to select one of the tags. In a second step I thought Views would be a good way to create this list of all the event dates to a specific offer by showing Content of type Event but I don't know where to go from there because I can't specifiy that it should only show the events with a specific tag.

EDIT

Alright I think I'm a bit closer to the solution, but I'd still need some assistance from you guys.

What I did: Besides Views, I installed EVA. Created a View that is neither a Page nor a Block with the following settings:

Fields
– Filter Criteria
–– Content: Type (=Event)

Added an Entity Content with the following settings:

Entity content settings
– Entity type: Node
– Bundles: Offer

Not sure where to go from there though. Can I add some kind of Contextual Filters or Relationships between the Offer and the Events?

up vote 1 down vote accepted

Assuming the offer node holds a reference to the event node, this can easily be done without any custom modules.

  • Create a view with content type = offer.
  • Create a relationship to the event using 'A bridge to the Content entity that is referenced via', not 'A bridge to the Content entity that is referencing Content via'.
  • Add the date field into the field and use the relationship.

So for example, if it's a table view and you have one offer and two events, you should have two rows. offer 1 and event 1 date, and offer 1 and event 2 date. If you want them combined into offer 1 and event 1 date + event 2 date, then you can combine them using views distinct filter.

  • That sounds promising, thanks a lot! I'm afraid I'm missing a module here, do I need to get the References module? Currently I only have the Entity References module installed. – nihilistenhymne Dec 6 '17 at 15:49
  • Entity reference should be enough – Bl33s Dec 6 '17 at 16:46
  • Still playing around with the settings but this worked perfectly, thank you so much! – nihilistenhymne Dec 15 '17 at 10:05

You can use node reference field for this scenario nodereference_field

  • Thank you for the module suggestions! Though I'd really like to implement that with Views, also since the module isn't covered by Drupal’s security advisory policy… – nihilistenhymne Dec 6 '17 at 15:02

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.