2

I have job nodes, that relate to organizations. I want a sidebar block that will display other jobs that are related to the same organization.

I have tried a lot of different permutation of contextual filters and relationships, but so far I have not been successful.

I can only get the nid of the current node via a contextual filter, but that filters the content directly. I need just to get the referenced organization node, and then filter the view by that reference, but I can't seem to make it work.

(This question is for Drupal 7 with entity reference. The same question for Drupal 6 is here).

1
  • Try selecting the relationship on the contextual filter. Commented Jun 14, 2012 at 13:46

1 Answer 1

3

I found another (better) solution which doesn't require writing PHP if you're referencing taxonomy terms.

  1. Make sure you're filtering the view by the content type you want to view a list of, not the one you're trying to reference.
  2. Add a contextual filter using the entity reference field.
  3. Select 'Provide default value' and select 'Taxonomy term ID from URL'.
  4. Check the box for 'Load default filter from node page, that's good for related taxonomy blocks', along with whatever other configuration you want.
  5. Save the view and check it out.

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.