Problem/Motivation

User stories:

As a site builder for a site with content in more than one language, I would like to be able to filter results by the current language in the page request.

Proposed resolution

Add token replacement to the Value field in the Views filter UI.

Remaining tasks

  1. Update issue summary
  2. Write a patch
  3. Review and feedback
  4. RTBC and feedback
  5. Commit

User interface changes

You can now use tokens in the filter value.

API changes

None.

Data model changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mparker17 created an issue. See original summary.

mparker17’s picture

Here's a patch. Feedback welcome.

jmdeleon’s picture

Trying this out right now... I like :)

  • jmdeleon committed 719ac6c on 7.x-1.x authored by mparker17
    Issue #2853262 by mparker17: Add token substitution to views filter...
jmdeleon’s picture

Status: Active » Fixed

Highly useful.

mparker17’s picture

Assigned: mparker17 » Unassigned
Status: Fixed » Needs review
FileSize
1.32 KB

@jmdeleon, thanks!

***

For reasons I don't fully understand, my site has decided to start using the SarniaViewsHandlerFilter class in handlers/handler_filter_date.inc instead of the SarniaViewsHandlerFilter class in the handlers/handler_filter.inc. I haven't made any changes to any other files in the Sarnia module; and I'm not even sure how the two classes (which have the same name AFAICT) can be loaded into the same namespace without conflicts, but it seems to be happening, and removing files[] = handlers/handler_filter_date.inc from the .info file apparently causes missing/broken handler errors.

Whatever the reason, it seems I also have to patch handlers/handler_filter_date.inc if I want token substitution to continue to work on my site. Here's another patch. Interdiff not necessary due to the fact that the previous code was committed.

jmdeleon’s picture

@mparker17: The situation with the duplicate classes is definitely curious.

handler_filter_date.inc only overrides the function admin_summary() that isn't already in handler_filter.inc, which might be the cause of the broken/missing handler errors when removing handler_filter_date.inc from sarnia.info

So I copied the admin_summary() function to handler_filter.inc and was able to remove handler_filter_date.inc completely without any broken/missing handler errors, while still incorporating your new token support.

Attaching a patch here.

jmdeleon’s picture

Updated the patch in #7 slightly to apply a bit more cleanly.

Status: Needs review » Needs work

The last submitted patch, 8: 2853262-8-sarnia-remove_duplicate_handler_class.patch, failed testing.

  • jmdeleon committed 7ebb0d1 on 7.x-1.x
    Issue #2853262 (patch #7) by jmdeleon, mparker17: Add token substitution...
jmdeleon’s picture

Status: Needs work » Fixed
mparker17’s picture

Issue summary: View changes

Updating issue summary.

mparker17’s picture

Issue summary: View changes

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.