In Drupal 7 I have a news content type with a simple related news selection list. This works like a charm, I use an entity reference view to fill the list and new news-items are created just like they should be. But once the news-item is published it will of course be shown in the list. If you select it, the standard behaviour will be to render its full content view, resulting in a recursive content error.

How can I create an entity reference view that excludes the current node? I have found a lot of related issues, but nobody seems to answer the question of using parameters at all in this special kind of view. I tried to add an argument to the filter using the token syntax which says "AND Nid not equals [node:id]" but that turns out to be ignored. I also found that when you include the view it is possible to send parameters to it, but I was unable to find documentation for how to use them.

Does anybody have more information/documentation about this?

1 Answer 1


there is a patch fixing that issue and helping you to use [node:nid] as an arg here.

Otherwise, did you try Entity Reference View Widget ?

The module has a way of hiding selected items from the View. Simply add a base field contextual argument (Product ID for products, Node ID for nodes, etc) and in the "More" fieldset enable "Allow multiple values" and "Exclude". Then edit the Entity Reference field, and in the widget settings enable "Pass selected entity ids to View ".

  • Thanks for the leads, I will look into it further. At the very least I misspelled nid as id there. Still I probably need the patch. Do you also have a hint of where to find more info about how to use submitted arguments from the content type?
    – titusn
    Commented Jan 28, 2013 at 15:57
  • What are you trying to achieve exactly ? Commented Jan 28, 2013 at 16:14
  • I just want to know how the argument system for entity reference works at all. It's a bit weird that there is no documentation for such a potentially powerful feature.
    – titusn
    Commented Jan 28, 2013 at 16:16
  • I don't really know, usually I set a custom PhP filter (or a contextual filter with php "when argument is not available") and use current_path, get the nid out of it and load it. I'd advise you to do the same, it's the simpliest for that use. Commented Jan 28, 2013 at 16:37
  • I am using aliases and clean URL's, how can I get the nid out of the path then? Also it seems like a hacky solution if there is an internal parameter passing mechanism.
    – titusn
    Commented Jan 29, 2013 at 8:14

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.