0

I've got a view of "webinars," that contains an entity reference "speakers" that can have multiple entries. I can't get those entity references and their own fields into the listings for each webinar, correctly.

I've tried to do this with Views Field View module, but every tutorial shows Taxonomy ID is used. I can't. This isn't a taxonomy. I tried using Content ID, but it doesn't work. What the heck am I missing?

I want:

WEBINAR 1
speaker1, title, company
speaker2, title, company

WEBINAR 2
speaker 2, title, company
speaker 3, title, company

1 Answer 1

2

You don't need additional modules to introduce data from referenced entities into your views, you can do it with Relationships.

Your question title is about the Views field view module, but your question text reveals what you're really after, so I won't go into the Views field module solution because it's not the best way to go (performance-wise) if you can do it otherwise.

The Entityreference field on your "Webinar" nodes only lists titles of the "Speaker" entity, both on node pages and in Views.

To display information other than Title of the "Speaker" entities within "Webinar" views you have to add a Relationship through the entityreference field. That acts as a bridge to the other tables/data and makes them available for use within views.

In your case you should:

  1. Add a Title field and the "Speaker" entityreference field for your "Webinar" nodes (you probably already have this step)
  2. Edit the Speaker field and under Multiple field settings untick Display all values in the same row.

    This will make every speaker display as a separate views row.

  3. Add a Relationship Content referenced from field_speakers (or whatever the field name is in your case), require it if you don't want to see webinars in your results that don't have any speakers selected
  4. Add the "Speaker title" field, it will automatically use the above Relationship
  5. Add the "Speaker company" field, it will automatically use the above Relationship
  6. Under Format Settings set the Grouping field Nr.1 to Title (the Webinar one).

    This will take care of the way you want results grouped under each webinar title.

  7. Edit the Title field (Webinar) and set it to Exclude from display and under Style settings set the Customize field and label wrapper HTML to H2 or whatever makes the most sense in your case.
6
  • Ahh! Thank you. I had tried the above... But I think I veered off-course at step 6 - grouping by the title and never caught that I should try grouping by the title (no clue why!)
    – turpentyne
    Commented Nov 9, 2018 at 16:12
  • Sometimes it helps to have it pointed out :) As long as you got it working in the end ;)
    – prkos
    Commented Nov 9, 2018 at 17:22
  • A follow-up question, if you know. One thing I didn't anticipate is that I do have a "read more" button that goes after the title and the speakers. What I'm getting is a result where that 'read more' button shows up with each speaker, instead of at the end of each listing. I can overcome it by using that button as the 2nd group by... but I want it at the bottom, not in the top of each listing. Thoughts?
    – turpentyne
    Commented Nov 9, 2018 at 20:56
  • Read more link is applied to whole views results, not only parts of it. Grouping is just a way of breaking the whole results into smaller clusters, but it doesn't affect the More link. More link still applies to the whole Views results and shows up at the bottom. There isn't enough information to understand what's happening. How are you getting the link in each row? Did you just add another field? Where should this link lead? If you have a lot of speakers under each webinar and need a link there maybe you could override a template for grouping for that display and add the More link there.
    – prkos
    Commented Nov 9, 2018 at 22:41
  • oh.. sorry - I didn't clarify. My "read more" button is actually a custom text button, because I have to use a conditional views field to generate information in it.
    – turpentyne
    Commented Nov 10, 2018 at 7:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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