You are here

function template_preprocess_isotope_views_grid in Isotope (with Masonry and Packery) 7.2

Preprocess function to build the isotope grid.

File

isotope_views/isotope_views.theme.inc, line 10
Theme callbacks.

Code

function template_preprocess_isotope_views_grid(&$vars) {
  template_preprocess_views_view_list($vars);
  $items = array();
  foreach ($vars['view']->result as $key => $value) {
    $item['value'] = $vars['rows'][$key];
    foreach ($vars['options']['data_fields'] as $fieldname) {
      if (!empty($fieldname)) {
        $item['data'][$fieldname] = isotope_views_helper_get_field_value($value, $fieldname);
      }
    }
    $items[] = $item;
  }
  $output = array(
    '#theme' => 'isotope_grid',
    '#items' => $items,
    '#instance' => $vars['options']['instance_id'],
    '#config' => !empty($vars['options']['config']) ? $vars['options']['config'] : 'isotope_default_config',
  );
  $vars['isotope_grid'] = render($output);
}