0

I have two content types: "project" and "task" Using flag and with support of entity reference + flagging form, users can append very rapidly new "task" nodes to the current "project" node they are viewing. The structure then is the following:

  1. Node type 1 >> project
  2. Node type 2 >> task
  3. Flag >> task appended to project; actually is a "container" of an Entity Reference(with multiple value) field linked to task

My target is create with views, a list of appended "task" nodes and show that list in a block to the related "project" node. I believe that I should use relationship + contextual filter, but I have no idea on how to achieve my needs.

Could you help me? Thank you all in advance!

Update on 13-01-2017 16:45: Attached step by step after suggestion from pierostz. These steps were done before the configuration window uploaded at 15:00. enter image description here

Update on 13-01-2017 15:00: Attached contextual filter Nid after a first aattempt after suggestion from pierostz. enter image description here

1
  • Looks like Drupal 7. Please tag your question with the right Drupal version.
    – leymannx
    Jan 13, 2017 at 15:57

1 Answer 1

0

Create a new view showing tasks nodes. In your view use these settings.

  1. Add a relationship "Entity Reference: Referencing entity".
  2. Add a contextual filter of "Content:nid" with the relationship you previously created as the selected option on the relationship select box. Also provide the default value from "Content ID from URL".

enter image description here

  1. Create another contextual filter with "Content: References".
  2. Choose what fields to show as you normally do in a view.

I think this should do the trick.

4
  • Thank you pierostz for you kind reply. I tried to follow your guide, but i stucked on point 2, since I cannot find how to put "with the relationship you previously created as the selected option on the relationship select box". I add a screenshot to my main question in order to let you see what I have here. Thank you again!
    – in Cina
    Jan 13, 2017 at 5:16
  • See my newly attached screenshot...the only reason you might not get the Relationship box is because you didn't create the relationship itself (Step 1). Also use the same method I do to provide the default value.
    – pierostz
    Jan 13, 2017 at 8:28
  • Dear pierostz, thank you very much again. I actually created the relationship (at list I am convinced to), but seems like that the relationship I've created is not available. Check the new attached images, I've tried to "Add a new relationship" "Entity Reference: Referencing entity", but then when I try to add Contextual Filter the supposed created relationship is not available, I am doing something wrong?
    – in Cina
    Jan 13, 2017 at 8:55
  • hm...I really can't see how this is not working for you...try creating a different relationship to see if you get the box...
    – pierostz
    Jan 13, 2017 at 8:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.