function template_preprocess_isotope_views_filter in Isotope (with Masonry and Packery) 7.2
Preprocess function to build isotope filter blocks.
File
- isotope_views/
isotope_views.theme.inc, line 36 - Theme callbacks.
Code
function template_preprocess_isotope_views_filter(&$vars) {
template_preprocess_views_view_list($vars);
$items = array();
foreach ($vars['view']->result as $key => $value) {
$label = $vars['rows'][$key];
$fieldname = $vars['options']['data_fields'];
$filter_value = isotope_views_helper_get_field_value($value, $fieldname);
if (!empty($filter_value) && !empty($label)) {
$filter_value = is_array($filter_value) ? implode(',', $filter_value) : $filter_value;
$items[$filter_value] = $label;
}
}
$output = array(
'#theme' => 'isotope_filter',
'#items' => $items,
'#instance' => $vars['options']['instance_id'],
'#filtername' => $vars['options']['filter_group'],
'#filtertitle' => $vars['options']['filter_group'],
);
$vars['isotope_filter'] = render($output);
}