1

Normally one would add a flag link as field in a view, in order to be able to flag an entity of a views row.

However, I cannot add a flag link to a view that only shows entities using a relationship, since the flag link already uses its own relationship and apparently cannot have another relationship on top of that.

So the question is, how can I add a flag link so that it will flag entities in views rows that use a relationship?

My case: I have a view based on entities of bundle 'project'. I have added a contextual filter that selects only the currently viewed project entity. I have added fields of project content that reference the current project, using the entity reference field 'field_project'. The view shows all content referencing the currently viewed project. However, the flag that I add to the view does not flag the project content, but the viewed project. Result is that if I press one flag link, all flags appear as flagged in the view.

3
  • 1
    Something is wrong with your view as I have many views that do exactly what you've described. Have you definitely added the right relationship? Commented Oct 29, 2017 at 3:25
  • OMG you are right...I removed the flag, and re-added it, and suddenly the relationship field is available in the flag. The funny thing is that the flag was already present when I changed the view to only contain related entities, and when I tried to edit the flag relation properties, it did not give a field to add a relationship. Removing and readding the flag did help. Thanks!
    – Yuri
    Commented Oct 29, 2017 at 13:25
  • 1
    Good to hear it was an easy fix! Commented Oct 29, 2017 at 16:43

1 Answer 1

1

Quote from your own comment:

I removed the flag, and re-added it, and suddenly the relationship field is available in the flag. The funny thing is that the flag was already present when I changed the view to only contain related entities, and when I tried to edit the flag relation properties, it did not give a field to add a relationship. Removing and readding the flag did help.

So it seems that "removing and readding the flag" is the solution to answer your question.

Credits: Yuri and Niall Murphy.

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.