You are here

function template_preprocess_views_isotope_views_sorter in Brainstorm profile 7

Preprocess function for isotope sort blocks.

File

modules/custom/views_isotope/views/views_isotope_views.theme.inc, line 73
Theme callbacks.

Code

function template_preprocess_views_isotope_views_sorter(&$vars) {
  template_preprocess_views_view_list($vars);
  $items = [];
  foreach ($vars['options']['data_fields'] as $fieldname) {
    if (!empty($fieldname)) {
      $field = $vars['view']->field[$fieldname];
      $label = $field->options['label'];
      $items[$label] = $fieldname;
    }
  }
  $output = [
    '#theme' => 'isotope_sorter',
    '#sorts' => $items,
    '#instance' => $vars['options']['instance_id'],
    '#original' => $vars['options']['original'],
  ];
  $vars['isotope_sorter'] = render($output);
}