I have two similar content types on a Drupal 8 site: groups and projects. Groups can have child projects, but a project does not necessarily have a parent group. I have an entity-reference field on the Project content type, where a parent group can be added.

However, as I am setting up many different views, I would like these child projects to be added to the Groups nodes when users add parents to the Project nodes. In other words, I want to automatically update the field "Projects" on the related node of the "group" type.

How would I go about doing this? I see most people recommend showing a block on the node, but I would like to use this field in various views, so that won't work.

3 Answers 3


So if I undersand you don't have any relation Groups -> Projects? You just have a relation Projects -> Groups (that you also call parents)? . And you want to show by views, Groups and their children (projects)?

If this is what you want you have several choices.

  • Add many relationships in the view advanced filters in order to reach groups projects, (could be tricky).
  • Add a field entity relationship Groups -> project that you programmatically set on every projects insert/update/delete. Thanks to this it would be much more easier to build a view.
  • create your own custom block, with your dedicated SQL query. listing all children of a group and attaching this block to all "groups" content type pages.
  • Yes, that is correct, they are only connected from projects to groups now.. The project type is set up like this: imgur.com/a/uwSus The reason I would like to add the fields to the nodes of the "parent" (to "relate" them back), is that I am setting up this and other views: cc-moon.net/groups where I would like to show the child projects of each group in the table. However, if I try to link them in this view, I'm not able to show all groups because of that. I was thinking of trying Rules, but it looks like there is no Rules UI for D8 yet? Apr 7, 2017 at 8:21
  • Indeed Rules seems out of activity... The best thing would be a 2 way reference field but nothing stable yet either... You can try drupal.org/project/cer but no promises about the result. I had to do something like that with "courses" and "lessons". Courses have lessons and a lesson is in a course. So i chosed to hook on node insert/update/delete to maintain these 2 relation fields programmatically. Apr 7, 2017 at 8:39
  • I'm not proficient enough to do this programmatically, unfortunately. If Rules is a no-go, I will check out cer - thanks for the heads-up! Almost sad I chose D8 for this project instead of D7, even though D8 has it's benefits also. Apr 7, 2017 at 8:44
  • CER is too recently ported as well, it seems. Does not show up in coffee or the menu, and when I googled the link referring to the admin-page it is non-existent. I guess I will leave it activated, and hope for an update in the future. :) Apr 7, 2017 at 8:58
  • Nevermind - Rules was causing problems. Deleted this and flushed the cache, and it appeared. Will try it out, thanks! :) EDIT - It worked!! Thanks a bunch! :) Apr 7, 2017 at 9:03

Using CER ( https://www.drupal.org/project/cer ) as suggested by Nikko worked as intended. When adding a parent group, the project is added to the group node. Which means I can hide the field, and will make setting up the different views on the page 100x simpler.


I don't think that create two references is a good option when you only need one in the project content type.

If you want create a view to show all the project of a group you should add in the view a Contextual Filter to the field_related_research_group field. If you want to show the view in a Group node page then you can chose the Provide default value option and as type Content ID from URL.

enter image description here

In your Filter Criteria the content type must be project.

  • This is not a good solution in this case. I am already using this approach to show information on nodes/user pages, but in this case I want the information to displayed to the user in searchable views of nodes of both content types - only one of them should be displayed at the time though. The module in question lets me achieve exactly that - the result can be seen at cc-moon.net/groups :) Apr 10, 2017 at 10:08

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.