0

I have a view which show 4 related nodes based on category. Issue is that there is an entity reference product_group, in the node, and I want to show only those nodes which are not in product_group reference field.

This only involves one content type.

  • Add the product reference field in the filter criteria and apply "is empty" filter in that. – Shubham Mar 18 '16 at 7:11
0

THis things might be solved in many ways, but the 2 solutions which we can use is.

  1. We can add entity reference filter in Filter section of view. Entity Reference Filter is a view of type entity reference, and it should return node id based on arguments, and in our parent view, we can apply condition, that is not one of.

  2. We can add a contextual filter of NID, with option of provide default value >> fixed value, and under more section, we can check exclude checkbox. After that we can use hook_views_pre_view, to set the argument, if it is first contextual filter, then using $arg[0], if it is second contextual filter, then using $arg[1].

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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