0

In Drupal 7, I have a content type that displays a content view within it. This view display contains 4 exposed filters. On the content type, I have a custom select field which allows the author to choose which exposed filters they want to hide on the embedded view.

I then take these selections from the node. Using hook_views_pre_build(), I'm able to hide (by unsetting) any filter they don't want. It works great upon initial load of the page.

However, the exposed filters use AJAX. When a visitor uses one of the exposed filters and the view loads the filtered display, it no longer respects my hook_views_pre_build() settings. Any filter I hid in that hook are now exposed again in the AJAX-generated views display.

Which hook (or combination of hooks) can I use to hide filters not only in the initial page load, but also when an AJAX filter is used/loaded and the view refreshes?

1
  • I basically solved this by realizing that it's only a problem when using EVA (entity views attach) to display the view. I recreated the view as a block and manually embedded it in a node template and didn't have this problem. So something about this problem is EVA-specific.
    – Feature
    Mar 31 at 15:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.