Drupal 7. I have a custom filter handler which needs to amend the views query. As the filter can be added to any view I can't simply check for view name in the hook_views_query_alter()

I know the filtername exists somewhere in the $views parameter to hook_views_query_alter() within its arrays of array of objects I have yet to find an efficient way of checking if the filter is in use.

anyone come up with a solution to similar?


Found a way, you can check for the filtername in the view object e.g. if (isset($view->filter['myfiltername'])) {

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.