--- views_filterblock-original.module 2007-01-25 05:13:24.000000000 -0800 +++ views_filterblock.module 2007-05-29 15:09:05.000000000 -0700 @@ -21,17 +21,26 @@ function views_filterblock_menu($may_cac 'access' => user_access('administer site configuration'), 'type' => MENU_NORMAL_ITEM, // optional ); + return $items; } function views_filterblock_settings() { - $form['views_filterblock_num'] = array( - '#type' => 'select', - '#title' => t('Number of Blocks'), - '#options' => drupal_map_assoc(range(1, 10)), - '#default_value' => variable_get('views_filterblock_num', 1), - '#description' => t('Select the number of blocks'), + $form = array( + 'views_filterblock_num' => array( + '#type' => 'select', + '#title' => t('Number of Blocks'), + '#options' => drupal_map_assoc(range(1, 10)), + '#default_value' => variable_get('views_filterblock_num', 1), + '#description' => t('Select the number of blocks'), + ), + 'views_filterblock_usefieldset' => array( + '#type' => 'checkbox', + '#title' => t('Use Fieldsets'), + '#default_value' => variable_get('views_filterblock_usefieldset', true), + ), ); + return system_settings_form($form); } @@ -101,33 +110,52 @@ function theme_views_filterblock($form) // make the 'q' come first $output = drupal_render($form['q']); - - foreach ($view->exposed_filter as $count => $filter) { - $newform["fieldset$count"] = array( - '#type' => 'fieldset', - '#title' => $filter['label'], - '#collapsible' => TRUE, - '#weight' => $count - 1000, // we'll never have this many filters - ); + $curcount = 0; + $usefieldset = variable_get('views_filterblock_usefieldset', true); + + if($usefieldset) { + foreach ($view->exposed_filter as $count => $filter) { + $newform["fieldset$count"] = array( + '#type' => 'fieldset', + '#title' => $filter['label'], + '#collapsible' => TRUE, + '#weight' => $count - 1000, // we'll never have this many filters + ); + } } foreach ($form as $field => $value) { if (preg_match('/(op|filter)([0-9]+)/', $field, $match)) { $curcount = $match[2]; - $newform["fieldset$curcount"][$field] = $value; + if($usefieldset) { + $newform["fieldset$curcount"][$field] = $value; + } else { + $newform[$field] = $value; + if(array_key_exists($curcount, $view->exposed_filter) && array_key_exists('label', $view->exposed_filter[$curcount]) && !$usefieldset) { + $newform[$field]['#title'] = $view->exposed_filter[$curcount]['label']; + } + } } else { if ($field == 'submit' || drupal_substr($field, 0, 1) == '#') { unset($curcount); } if (isset($curcount)) { - $newform["fieldset$curcount"][$field] = $value; + if($usefieldset) { + $newform["fieldset$curcount"][$field] = $value; + } else { + $newform[$field] = $value; + if(array_key_exists($curcount, $view->exposed_filter) && array_key_exists('label', $view->exposed_filter[$curcount]) && !$usefieldset) { + $newform[$field]['#title'] = $view->exposed_filter[$curcount]['label']; + } + } } else { $newform[$field] = $value; } } } + return drupal_render($newform); }