Fast filters

Categories

Component ID

2389117

Component name

Fast filters

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Downloads

295

Component created

Component changed

Component body

Synopsis

This API module contains list of functions you can use to add basic filters to the custom lists (based on custom page callbacks, not Views module). Module will take care of form data storage (SESSION) and give you easy-to-use method to read data from storage unit.

Usage

Module works almost the same as well known system_settings_form(). In your filter form, instead of returning $form array, try:

return fast_filters_form($form);

That's it. Your form will be:

  • placed on the top of the page where you'll use it
  • wrapped in collapsible fieldset (check module config form)
  • divided into columns (configurable via config form) if you're using fieldsets in it,
  • automatically submitted via fast_filters_form_submit() - data will be stored in $SESSION

All values will be stored under 'default' scope, so if you use form elements with the same key across multiple filter forms you will share elements value. If you want to use separate scope per form, place this code before return fast_filters_form($form):

  $form['#filter_scope'] = 'your_scope';

To get filter value of form element:

// 'default' scope and default_value equal NULL.
$value = fast_filters_get_value($element_key); 

// For specific scope and default value.
$value = fast_filters_get_value($element_key, array(), $my_scope);

Credits

Module was sponsored by Ny Media AS

Dependencies

None