02
Jun

Drupal Views Custom Filter Handler

02 Jun
As I wrote in the previous article where we've created a custom Views Field Handler, now it`s time to create a custom Filter Handler for Views. As for the field handler we will create a custom module which will include the following:

1. In the .info file we shoul add:



2. In the example.module the hook_views_api() must be added.



3. hook_views_data() must be declared in example.views.inc which will be a new file created in the custom module.



If all steps are in place it`s time to build the filter handler into the example_handler_filter_field.inc



In the query you can also use values from the form_state. Also after the filter is added in the Filter Criteria in the view, a query alter is needed to filter after your chosen option from the Filter Handler.

Enjoy!


 
Leave A Comment