I've created a custom filter with a checkbox exposed field in my module.
class my_module_helper_handler_filter_timetracking_children extends views_handler_filter {
/*...*/
function value_form(&$form, &$form_state) {
$form['value'] = array(
'#type' => 'checkbox',
'#title' => t('Show subtasks'),
'#default_value' => isset($this->value) ? $this->value : NULL,
);
return $form;
}
/*...*/
}
When by default in Views UI settings checkbox is disabled, everything works fine; when it's enabled, it doesn't work. It doesn't respect the default value and the $_GET parameter.
I can't understand this strange behavior of single on/off checkboxes in exposed filters in a view.
I also tried using '#attributes' => array('checked'=>'checked')
, but the filter didn't work correctly.
Might somebody can show his code how to create custom exposed filter with single checkbox? Or give usefull link