Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I've created custom filter with checkbox exposed form in my module:
class my_module_helper_handler_filter_timetracking_children extends views_handler_filter {
/**
* Clear query alter
*/
function query() {
}
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 it's dissabled it works fine. But when It's enabled by default in views UI id doesn't respect default value and $_GET parameter.
I can't understand this strange behaviour of single on/off checkox in exposed filters in view.
I tried also to use '#attributes' => array('checked'=>'checked') but filter didn't work correct.
Comments
Comment #1
dawehnerIf you want to use checkboxes, maybe checkout the better_exposed_filters module.
See http://drupal.org/node/577682#comment-2043986