1

I have a D8 entity reference field question. I have 3 content types: Student, Class, Book.

A student can have several classes and a class can have several books. I have in student an entity reference field of type content connected to classes. I have in class an entity reference field connected to books.

In a view (block student class book) I want to show the student name, his/her classes and the books associated with each class.

I am able to create a view showing the student and it's classes (using the relationships option in a advance) but the books are not showing up!

Please can somebody help? Thanks

1

If you don't need to have filters or sorting or other view related things interacting with books or classes then I would set the view up to not display fields and use relationships, etc. Rather I'd configure it to display a view mode of the Student. Then do all display configuration for what should appear about the student in that view mode. I find using view modes, vs configuring fields directly in the view, to be an easier way to configure views in most scenarios. Plus if you need to display the same information somewhere else, it's much easier to re-use the view mode vs having to re-configure a view.

In your view, instead of showing fields, show Content and then choose a view mode of your Student. (You can create new view modes at /admin/structure/display-modes/view or Manage > Structure > Display Modes > View Modes in the admin menu.)

Then update your Student view mode via the manage display to show whatever student content plus the classes field. Configure your classes field to, again, show a particular view mode.

Then update your Classes view mode to show whatever content you want to display about the class plus the books field (not sure if you'd want to show just the label or again another view mode).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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