Hello,
I'm using views-isotope for a travel site and would like to replace the taxonomy terms in the filter block by images that come from a taxonomy image field.
I've come to the conclusion that this is not possible due to the way views-isotope uses the taxonomy terms as filter classes.
So i added the taxonomy name and image fields in the filter block, and wrote probably one of the worst php hacks ever (i'm not a drupal dev) so filter classes are created from taxonomy terms which will be stripped from final output:
In file views-isotope-filter-block.tpl.php i added the following after line 15:
// Detect presence of an image
if (strpos($row, '<img'))
{
// Strip the taxonomy term from row and rewrite it as filter class
$row_field = explode("<img", $row);
$filter_class = trim(strip_tags(strtolower($row_field[0])));
$filter_class = str_replace(' ', '-', $filter_class);
$filter_class = str_replace('/', '-', $filter_class);
$filter_class = ".".str_replace('&', '', $filter_class);
// Use the filter class
$isotope_filter_classes[$count] = $filter_class;
// Inject only the image tag in the row
$row = "<img".$row_field[1];
}
Is there any chance to see that kind of feature in a next release without my hack ?
Regards,
Ozy.
Comments
Comment #1
deajan commentedComment #2
deajan commentedComment #3
deajan commentedComment #4
Chris Gillis commentedFixed in 7.x-2.0-beta1. The filter view now lets you select which fields to use for data (filtering / sorting) and all other fields (e.g. images) will only be used for display.