2

Please help me and provide a little explanation about the following thing:

1) What I have:

  • a content type called "word"
  • a flag for this content type called "learned".
  • a view display with "word" nodes

2) What I want to achieve:

  • filter view results with "learned" flag state (to get only flagged, or not flagged, or all of them) for current user via contextual filter.

I've added a relationship on "Flags: Content flag" where i can limit results to those nodes, which are already flagged by current user. But honestly I don't understand how to connect this relationship with contextual filter to get a possilibily to receive different results basing on the flag state (flagged, unflagged, all).

Actually, I want to get the same result as if I use an exsposed filter on a Flag state. But I don't want to use an exposed filter as well as I'm using an ajax call to load this view display with predefined options.

Any help?

  • With contextual filters, I don't think it's possible. You have to use an exposed filter. Just wondering why is this an issue? – No Sssweat Dec 25 '15 at 22:29
  • @NoSssweat, yes, I see already that its hardly possible with contextual filters. I don't want to use them as well as i'm working a tool (for learning new foreign words) which creates a set of flash-cards basing on some options selected by a user. Some of those options depend of a flag state and are needed to load a view, some other - for quite different purpose. So, a user selects a set of different option and my tool loads a view display (by ajax) with a selected flag state. Anyway I think I've found a solution with exposed filters - sending values via url and hiding the filter itself. – john Dec 27 '15 at 16:40
1

Not with contextual filter, in views I think it's posible with a normal filter (not exposed) since you have already the flag relationship, first add your flag as a field (don't display it if you want) then just filter your nodes with the flag status (flagged). Then you clone the view and change flag status on filter (now to unflagged) and you will have an opposite view (non-flagged) content.

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.