Automatically group and generate content in a node

Hi,
I am writing to ask if someone knows how to automatically group and generate content in a node.
Basically i have 2 content types:
1- Project
2- Part.
The Part content type has a field that refers to content type project.
Do you know if it is possible to generate automatically in the PROJECT node a list with all the PARTS that are created and linked to the project in question?
Thanks!

Hello,

Display content using vertical boxes and rendering only nodes tagged with the same terms as the current page

I guess this could be the thing that you’re looking for… you might change the display from Vertical Boxes to a list.

Kind regards,
Nadine

Hello Joao,

Yes you can do it using a block view. In general you want to display the parts that are referenced from the visited project. The steps you need to follow:

Given that you have a created the projects and the parts…

  • Create a view
  • In the view create a block display, since you want to place it in the node page of the project
  • Choose to display nodes of content type part
  • Add a relationship of type Entity Reference: Referenced Entity. This relationship will actually connect the parts with the visited project
  • Add a contextual filter of type content:nid. This stackoverflow post explains how to configure the contextual filter. This contextual filter actually filters only the parts that are referenced by the visited project.

After creating the block view, visit the Block Layout and add the block you created to appear in the nodes of Project content type. You can add it to appear either under or in one of the sidebars etc.

Thats pretty much it. Let me know if you have any questions or if something does not work.

Konstantinos

Hi Konstantinos,
Thanks for your reply.
i wa strying to follow your instruction but when i create the view https://ep-dep-dt-eo.web.cern.ch/parts-for-project i can’t find the options you referred i.e.: Entity Reference: Referenced Entity and content:nid.
the project content is : https://ep-dep-dt-eo.web.cern.ch/node/add/composite_project
and the part content is: https://ep-dep-dt-eo.web.cern.ch/node/add/composite_part
Please let me know if you had any advice.
thanks,
Joao

I will have a look and I will let you know

Konstantinos

Hello Joao,

I took the initiative to open the view and modify the aforementioned relationship and contextual filter

  1. I added a relationship that connects the parts to the visited project, given that the block will be placed in a project node
  2. I added a contextual filter that displays only the parts that are connected to the visited project

The final result of the view looks like the following screenshot:

As you can see when I add the node id to the preview of the view, I get the correct result since If you visit the project with node ID 371, you will see that it references the part 5

All you have to do now is to place the block to be displayed in nodes of content type Project. Then the block will display the parts of the visited project.

Let me know if it is clear.

Konstantinos

Thanks Konstantinos!
it works!