Project:Multi-column checkboxes radios
Version:6.x-1.x-dev
Component:Documentation
Category:support request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

I'm trying to split up a column of checkboxes of an exposed filter from a view (I used Better Exposed Filters to create the checkboxes). I've read the readme but Drupal is pretty new to me so it's a bit over my head. I'm not sure if I need to add code and if so where. Do I need to edit/override a form in the views module somewhere? Is there a verbose example I can follow somewhere?
Thanks.

Comments

#1

Use hook_form_alter() or hook_form_FORM_ID_alter() to alter the form views creates, add the multicolumn parameters to the expose filter checkboxes.

#2

Thanks for the reply. Does this get done in a views php template file somewhere?

#3

You write a module and implement the form_alter() there.

#4

Status:active» closed (works as designed)

~

#5

Version:6.x-1.6» 6.x-1.x-dev
Status:closed (works as designed)» active

Tried the above suggestion against the following Views exposed filter form, also using the BEF module:

* Form ID is : views_exposed_form
* Form array is :

  Array
  (
      [#info] => Array
          (
              [filter-tid] => Array
                  (
                      [operator] => tid_op
                      [value] => type
                      [label] => Select Number of Bedrooms:
                  )

              [filter-tid_1] => Array
                  (
                      [operator] => tid_1_op
                      [value] => price
                      [label] => Select Payment Range:
                  )

              [filter-tid_2] => Array
                  (
                      [operator] => tid_2_op
                      [value] => location
                      [label] => Select Neighborhood
                  )

          )

      [type] => Array
          (
              [#type] => select
              [#multiple] => 1
              [#options] => Array
                  (
                      [1] => Studio
                      [2] => 1 Bedroom
                      [3] => 2 Bedroom
                      [4] => 3 Bedroom
                  )

              [#size] => 4
              [#default_value] => Array
                  (
                      [1] => 1
                      [2] => 2
                      [3] => 3
                      [4] => 4
                  )

              [#description] =>
              [#theme] => select_as_checkboxes
          )
.
.
.
      [#id] => views-exposed-form-property-search-page-1
.
.
.

Using the following hook_form_alter callback (form ID verified with normal hook_form_alter):

<?php
/*
* Implementation of hook_form_FORM_ID_alter for "views_exposed_form" form
*/
function mymodule_form_views_exposed_form_alter(&$form, $form_state) {
 
// Pick out the form for the property list view
 
if ('views-exposed-form-property-search-page-1' == $form['#id']) {
   
$form['type']['#multicolumn'] = array(
     
'width' => 2,
    );
  }
}
?>

No love. It appears that the BEF module is altering the form using hook_form_alter to add a callback to the #theme option of the form element, and the multicolumncheckboxesradios code appears to be adding a callback to the #process option.

I'm not 100% up on my FAPI callback execution order (#process vs #theme), but might this be why it isn't working?

nobody click here