2

I am trying to create a view to filter content types assigned to a specific country (set using Address Field module), determined by the current node's title.

My address field is not being listed under relationships in views.

How am I able to set contextual filters by a nodes country? Is this currently possible, or am I just missing something?

0

The country should be filtered by the current node's title

The better approach is to create Taxonomy Terms, so you can tag your nodes.

In admin/structure/taxonomy Add a vocabulary called Countries.

Then add a term reference field to your content type and select countries as your vocabulary, and use auto complete widget.

So all you have to is type the country name here and it will tag your node with that name.

In views, for contextual filter add Has taxonomy term ID

enter image description here

PS: You could use the Rules module to auto tag your nodes based on the Country field value.

  • Thank you for your response. I also see the country field under contextual filters, however not under relationships. It is my understanding I will need to add the country field to relationships so I can filter event nodes based on the current page's title (or ID). – BokBok Sep 2 '16 at 21:57
  • @BokBok did you get it to work? – No Sssweat Sep 2 '16 at 21:57
  • No I could not. Details are in my edited comment above. – BokBok Sep 2 '16 at 22:02
  • @BokBok see my edited answer. – No Sssweat Sep 2 '16 at 22:13
  • 1
    Thank you! The above answer sounds like it will work perfectly. I really appreciate all your help! – BokBok Sep 3 '16 at 9:17

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.