I have the following setup: a content type (event) can have a "mother" event, which is configured as entity reference (Basically it's the same event on another date).

I have a view for a single event which is embedded in a panel pane and another view for the other similar events (with the same "mother") in another panel pane on that page.

This works pretty good, except when i try to filter out the event that is shown on the first pane from the second pane, so that this one isn't shown twice.

The view for the "related events" has a contextual filter of the nid and relationship to the "motherevent" which is set to "required".

Now you would say, check the exclude field for the contextual-filter. Yes, this works, but with a side effect: all other events not related to the "mother" are shown as well.

I feel like I have arbitrary tried all possible combinations of "set relationship" / required and so on, but with no effort. I even tried a second contextual filter of the nid with different settings... I don't get it.

Can someone please explain how this could be achieved? Thanks a lot!

  • Are you viewing the mother event on the page, with the panels displaying the children? Or is the page set to a child event, and the views are displaying other children related to the same mother? Is the mother event anywhere in the views?
    – Triskelion
    Commented Apr 9, 2013 at 23:28
  • I use Panels displaying both views (event node & same events) overriding the drupal node view.
    – Volker
    Commented Apr 10, 2013 at 4:58

1 Answer 1


The problem I believe is the relationship. I assume the entity reference on each event points to the parent event, including that on the parent (recursive).

Get rid of the relationship. Set up two contextual filters, one on Content:Nid and the other on Content:field_parent.

On the configuration for the contextual filter on NID, set the default value to Content ID from URL, open up the 'More' settings, and select 'Exclude'.

For the contextual filter on field_parent, set the default value to PHP Code and use something like the following:

$node = menu_get_object();
return $node->field_parent['und'][0]['target_id'];

This will get the ID of the parent from the current node, and will require all nodes displayed to have the same parent. The exclusion of the current node from the list will work, and you will have a list of all other children related to the same parent.

  • This is what i already tried (and wrote in my Q), but then i also have ANY other event that has no relationship to the "mother" in my views list. I need a way to filter these out...
    – Volker
    Commented Apr 9, 2013 at 22:48
  • You're right. Faulty reading on my part.
    – Triskelion
    Commented Apr 9, 2013 at 23:24
  • 1
    @Volker - Answer updated. Sorry about the false start. Will spend some time learning to read :-)
    – Triskelion
    Commented Apr 10, 2013 at 0:34
  • Wow! Thank you, it works... And I will spend some time learning PHP! :)
    – Volker
    Commented Apr 10, 2013 at 4:53

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.