Saved highlights not showing up when re-theming filters

sdsheridan - December 14, 2007 - 04:43
Project:Views save filter
Version:5.x-1.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

I'm using this module which seems to work very nicely save for one thing, which is probably of my own doing, but I don't know how to fix it. On one site, the highlights of the saved filters show up when I recall a view from some other window. However, on another site i have, I've re-themed the filters as shown below, because i have 10 of them, and there's no way they'll fit nicely across the screen.

<?php
/**
* Improve the layout of exposed filters.
* @param $form
*   The view with the exposed filters.
* @return the result of the form rendering.
*
* Modification made by SDSheridan, 31/10/2007.
*/
function phptemplate_views_filters($form) {
 
$view = $form['view']['#value'];
 
$number_exp_filters = count($view->exposed_filter);
 
$i = 0;
 
$output='<table border="0" cellpadding="2"><tr><td colspan="5">Choose search criteria from ' . ( ($number_exp_filters > 1) ? 'these filters:' : 'this filter:</td></tr>' );
  foreach (
$view->exposed_filter as $count => $expose) {
 
   
$i++;
   
   
$label = '<div class="form-element-label">' . $expose['label'] . '</div>';
   
   
$formelement = str_replace( 'form-select', 'form-filter-select', drupal_render($form["op$count"]) . drupal_render($form["filter$count"])); // replace the class for the filter list box
   
$formelement = preg_replace( '/size="\d"/', 'size="8"', $formelement ); // Make all select boxes 8 items long
   
   
$filter ='<div class="form-element-filter' . $count . ' form-element-' . $expose['label'].'">' . $label . $formelement . '</div>';

    if (
$i % 5 == 0) {
     
$output .= '<td valign="top">' . $filter . '</td></tr>';
    }
    else
    {
      if(
$i % 5 == 1 ) {
       
$output .= '<tr>';
      }
     
$output .= '<td valign="top">' . $filter . '</td>';
    }
  }
  if (
$number_exp_filters % 5 != 0) {
    for (
$j = $i % 5; $j < 5; $j++ ) {
     
$output .= '<td></td>';
    }
   
$output .= '</tr>';
  }
 
$output .= '<tr><td colspan="5">' . '<div class="form-submit-button">' . drupal_render($form['submit']) . '</div>' . '</td></tr>';
 
$output .= '</table>';
  return
drupal_render($form['q']) . $output . drupal_render($form);
}
?>

So the question is, how do i get the selected="selected" back into the options so that they appear highlighted when i first open the view?

Any help would be appreciated.

shawn

#1

avf - April 14, 2008 - 11:23
Status:active» closed

Presumably this has been fixed now?

#2

sdsheridan - April 14, 2008 - 19:36
Status:closed» active

No, it hasn't been fixed. I just somehow managed to get views_saved_searches working, and gave up on trying to get this to work properly. And I had no response. But I'd like to have it work...

 
 

Drupal is a registered trademark of Dries Buytaert.