Question

I have two entites: "Ship company" and "Ship"

Ship company attributes:

  • Title
  • Description

Ship attributes:

  • Title
  • Description
  • Image
  • Entity reference to "Ship company"

Now I need to display a list of all ship companies on one page. I want to display each row in specific format containing these fields:

  • Ship company title
  • Ship description
  • Display ships related to company. I need to display up to 6 ships. If there will be more than 6 related ships, I need to display max 6 ships and link to company detail.

I've started to create the view which render "Title" and "Description" fields for each "Ship company". But I still don't know how can I display related ships for each row in my view output? Is there any easy clue how to solve it? Define my own PHP field?

Thanks a lot

Martin

Was it helpful?

Solution

You can use module Views Field View (https://drupal.org/project/views_field_view) which will allow you to display view in a way of a field of another view. So you create view for your ships and then display it as a field of ship companies view. The "parent" view will pass node id as an argument to the "child" view to filter the Ships correctly. Read readme.txt of the module for more info if necessary.

However, this solution has a drawback - performance. Do not use this if there will be potentially dozens of Ship companies on one page load.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top