How to reference nodes from the same group?

Created on 7 June 2018, over 6 years ago
Updated 5 January 2025, 21 days ago

I have two types of nodes referenceable from the group. Let's say "sheep" and "wolfs".
In the next step, I need to reference the one node type from another. Let's say to reference the sheeps that a particular wolf would like for dinner.

Let's say we have a group called "the Shire". In this group there are sheeps "bee", "baa" and "tasty" and the wolfs "big bad wolf" and "woofy". Now, these two wolves should not be able to eat the sheep from other groups...

Thus, I set the the entity reference type for the "sheep ordered" field to "Views_ filter by entity reference view" and I build na entity reference view that takes the group id as contextual filter. This works perfectly on node creation - the wolf can indeed only order the sheep from it's own group and not from other groups.

the problem starts when I try to edit an existing node. "Group ID unavailable when editing the referenced entity (2717981)" has been resolved in RC2, so I can indeed edit the node again, but the entity reference view doesn't know this. Result: on edit, the view either returns all nodes from all groups or no nodes at all, depending on its configuration. Our poor wolf can express its feeding priorities once, when it's born, and this can never be updated. :-(

Help?
------------
Update

I have found a workaround for this issue. The workaround is simple: use the "group nodes" for all the content.
The side effect is that users get 2-step edit form and all they need to do in the first step is to define a title. Or Title + some of the content fields but *not* the links to other content from the same group.

since the group nodes (relations) are generated and edited in the group context, I can always use the PATH to extract the group ID in the contextual filter and filter the right nodes accordingly.

💬 Support request
Status

Active

Version

1.0

Component

Code

Created by

🇦🇹Austria Deno

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024