function theme_isotope_sorter in Brainstorm profile 7
Default theme implementation for the sorting list.
Parameters
array $vars: Variables for theming.
Return value
string Markup.
2 theme calls to theme_isotope_sorter()
- template_preprocess_views_isotope_views_sorter in modules/
custom/ views_isotope/ views/ views_isotope_views.theme.inc - Preprocess function for isotope sort blocks.
- views_isotope_example_theme_page in modules/
custom/ views_isotope/ views_isotope_example/ views_isotope_example.module - Page callback.
File
- modules/
custom/ views_isotope/ views_isotope.module, line 547 - Load the isotope library and provide configuration and theme options.
Code
function theme_isotope_sorter(array $vars) {
$attributes['class'] = 'isotope-options sorts clearfix';
if (!empty($vars['instance'])) {
$attributes['data-instance-id'] = 'isotope-instance-' . $vars['instance'];
}
if (!empty($vars['original'])) {
$vars['sorts'] = [
$vars['original'] => 'original-order',
] + $vars['sorts'];
}
foreach ($vars['sorts'] as $key => $value) {
$sort = is_array($value) ? implode(',', $value) : $value;
$label = empty($key) || is_numeric($key) ? $sort : $key;
$items[] = l($label, '', [
'attributes' => [
'class' => 'sorterbutton',
'data-sort-by' => $sort,
],
'fragment' => 'sorter',
'external' => TRUE,
'html' => TRUE,
]);
}
$return = [
'#theme' => 'item_list',
'#items' => $items,
'#type' => 'ul',
'#title' => t('Sort By'),
'#attributes' => $attributes,
];
return drupal_render($return);
}