function theme_isotope_filter in Isotope (with Masonry and Packery) 7.2
Default theme implementation for the filter list.
Parameters
array $vars: Variables for theming.
Return value
string Markup.
2 theme calls to theme_isotope_filter()
- isotope_example_theme_page in isotope_example/
isotope_example.module - Page callback.
- template_preprocess_isotope_views_filter in isotope_views/
isotope_views.theme.inc - Preprocess function to build isotope filter blocks.
File
- ./
isotope.module, line 484 - Load the isotope library and provide configuration and theme options.
Code
function theme_isotope_filter(array $vars) {
$multi_field_logic = 'OR';
$attributes['class'] = 'isotope-options clearfix';
if (!empty($vars['instance'])) {
$attributes['data-instance-id'] = 'isotope-instance-' . $vars['instance'];
}
if (!empty($vars['filtername'])) {
$attributes['data-filter-group'] = $vars['filtername'];
}
else {
$attributes['data-filter-group'] = 'unnamed_filter';
}
$title = !empty($vars['filtertitle']) ? $vars['filtertitle'] : NULL;
$items[] = l(t('All'), '', array(
'attributes' => array(
'class' => 'filterbutton',
'data-filter' => '',
),
'fragment' => 'filter',
'external' => TRUE,
));
foreach ($vars['items'] as $key => $label) {
$keys = explode(',', $key);
foreach ($keys as $k => $v) {
$keys[$k] = '.' . isotope_sanitize($v);
}
if ($multi_field_logic == 'OR') {
$keys = implode(', ', $keys);
}
else {
$keys = implode('', $keys);
}
$items[] = l($label, '', array(
'attributes' => array(
'class' => 'filterbutton',
'data-filter' => $keys,
),
'fragment' => 'filter',
'external' => TRUE,
'html' => TRUE,
));
}
$return = array(
'#theme' => 'item_list',
'#items' => $items,
'#type' => 'ul',
'#title' => $title,
'#attributes' => $attributes,
);
return drupal_render($return);
}