Posted by derjochenmeyer on July 17, 2007 at 11:16am
Does anyone have an idea how to display checkboxes instead of multiselect fields in the exposed filters of a view?
Does anyone have an idea how to display checkboxes instead of multiselect fields in the exposed filters of a view?
Comments
Form alter solution
You could check out this discussion: http://groups.drupal.org/node/5207
Or, a quick alternative If you want to turn ALL select fields of ALL views filters into checkboxes;
Create a module called 'viewsfiltercheckboxes.module' or anything you like, containing:
<?php
/**
* Implementation of hook_form_alter().
*/
function viewsfiltercheckboxes_form_alter($form_id, &$form) {
if ($form_id == 'views_filters') {
if(!empty($form)) {
foreach ($form as $id => $field) {
if ($form[$id]['#type'] == 'select') {
$form[$id]['#type'] = 'checkboxes';
}
}
}
}
}
?>
You also need an info file 'viewsfiltercheckboxes.info'
name = Views Filter Checkboxesdependencies = views
package = Views
Put these files in a subdirectory of your modules directory and activate the module.
Thanks!
Its what i was looking for!
----------------------
forward-media.de