1

I'm using the Views and Entity reference modules in Drupal 7. I'm trying to do the following: Make a view to list nodes of type A (teasers) Expose filters to filter this list

I have other nodes (type B) that reference A nodes. I would like to add an exposed filter in the form of "Has referring nodes" (of type B implicitly).

My problem is that the only way I am able to do it is by using operators like "greater than" and I don't find a "has" operator. I can implement it as "greater than 0" and it works but it looks really ugly because the user has a text field to put the 0. I would like to have a checkbox that toggles on/off a filter that works like "greater than a fixed value" or an actual "has" filter.

I think the question it is Views related but Ive mentioned the Entity relation just in case its important for the problem.

Thanks for your help.

PD: I have just thought that a "is referred" filter will also work, so thats a third possible solution I'm looking for.

1 Answer 1

0

If you are willing to have an extra field, consider using Corresponding Entity Reference.

It syncs the entity reference between two entity types which have an entity reference to each other, so double editing entities is no longer needed. If one entity has a reference, the other entity also receives a reference to the saved entity if it is referenced in that entity.

So basically, if properly configured, it will give you "is referred by" field you mentioned in your last paragraph.

For Drupal 6, use Corresponding node references module.

2
  • @garnav good luck. Feel free to ask for clarifications in comments. And if you have more specific CER questions (that shouldn't be needed but oh well), feel free to ping me here when you ask them, posting link as a comment.
    – Mołot
    Dec 2, 2013 at 13:02
  • @garnav glad it worked and thanks for accepting. It gives me that nice feeling of job well done :)
    – Mołot
    Dec 4, 2013 at 9:00

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.