I have a view with six exposed filters. I wish to wrap two of them in one div and the other four in another div. Is this possible?

I have figured out how to wrap each filter individually and how to wrap the whole bunch of them in a single div., but can't figure out how to split them up between two divs. Thanks.

Comments

Status:Active» Fixed

There is a template for that http://drupalcode.org/project/views.git/blob/refs/heads/7.x-3.x:/theme/v... you can use.

So you might write some preprocess code that organices them in two groups like that.

<?php
function theme_preprocess_views_exposed_form(&$vars) {
 
$left_widgets = array('text', 'type');
  foreach (
$vars['widgets'] as $id => $widget) {
    if (
in_array($widget, $left_widgets)) {
     
$vars['left_widgets'][$id] = $widget;
       unset(
$vars['widgets'][$id]);
    }
  }
?>

and then use these left_widgets in the template file.

Thanks. This helps a lot. It will take me a minute to get my head around it, but I really appreciate you pointing me to this.

I have the template file set up and waiting for the $left_widgets variable, but am having trouble withe the template.php file.

I pasted the function into the template.php file and changed

function theme_preprocess_views_exposed_form(&$vars)

to

function zurb_foundation_preprocess_views_exposed_form(&$vars)

and after I refresh the cache I get the WSOD?

The other functions that came in that file by default use $variables instead of $vars. Does that matter? Also, I checked to make sure there were no other function with the same name and there were not. Thanks.

Never mind. I'm an idiot. I made a different syntax mistake.

Not being too up on my PHP, I am a little confused as to how "$left_widgets = array('text', 'type');" tells the foreach statement which fields I want in one of the sections. I am guessing it would select each one that is of the type "text" but am not sure.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.