I modified the theme function to return a plain list of filter form elements
I'm planning on adding as a config option which output method to chose.
Here's the theme code for plain view:
<?php
function theme_views_filterblock($form) {
$view = $form['view']['#value'];
// make the 'q' come first
$output = drupal_render($form['q']);
foreach ($form as $field => $value) {
if (preg_match('/(op|filter)([0-9]+)/', $field, $match)) {
$curcount = $match[2];
$newform[$field] = $value;
$newform[$field]['#weight'] = $curcount; //assign weighting
if (!isset($newform[$field]['#title'])) {
$newform[$field]['#title'] = $view->exposed_filter[str_replace('filter','',$value['#name'])]['label'];
}
if ($newform[$field]['#type']=='textfield') {
$newform[$field]['#attributes'] = array('style'=>'width: 15em;'); //shrink textfield elements
}
}
else {
if ($field == 'submit' || drupal_substr($field, 0, 1) == '#') {
unset($curcount);
}
if (isset($curcount)) {
$newform[$field] = $value;
}
else {
$newform[$field] = $value;
}
}
}
$newform['submit']['#weight'] = 100; //fix submit button weighting to come last
return theme('views_filterblock_output', $newform);
}
?>
Comments
Comment #1
douggreen commentedDavid, Thanks! Are you proposing a patch? such as allowing the administrator to pick between the fieldset block and a non fieldset block?
I'm not sure if you're modifying the code for views_filterblock or if you've added a function to your theme for this. But the Drupal way is to add your new function in your theme template.php, but name is _phptemplate_views_filterblock or {yourthemename}_views_filterblock. That's why this function is a theme function, so that you can easily override it with something like what you've done here.
Comment #2
davidwhthomas commentedHi Doug,
Yep, I added that function into the views_filterblock.module file though a theme override would be a good solution too.
I just adding an admin setting to allow the 'block style' selection.
Depending upon the user selection, the theme function will return the corresponding output.
thanks for your work on this, much appreciated :-)
I've attached my updated version of views_filterblock.module
regards,
DT
Comment #3
davidwhthomas commentedDrupal ate my attachment, one more try...
Comment #4
futurist commentedNice feature, was trying to get rid of the fieldset too. Doug, is this going to be in 5.x-1.3? Thanks to both of you!
Comment #5
douggreen commentedNo, not going to be in 5.x-1.3. If anyone wants to submit a patch... I'd like to see this an option on the block settings page, and off by default.
Comment #6
dalvir commentedhi david
nice feature,
but i find that
it should return that
return $output . theme('views_filterblock_output', $newform);
instead of
return theme('views_filterblock_output', $newform);
then its working fine otherwise it goes to frontpage without result.
dalvir
Comment #7
pomliane commentedThis version of Views Filter Block is not supported anymore. The issue is closed for this reason.
Please upgrade to a supported version and feel free to reopen the issue on the new version if applicable.
This issue has been automagically closed by a script.