You are here

function template_preprocess_dxpr_gridstack_gridstack_style in DXPR GridStack 8

Same name and namespace in other branches
  1. 1.0.x theme.inc \template_preprocess_dxpr_gridstack_gridstack_style()

Implementation of template preprocess for the view style.

File

./theme.inc, line 35
Preprocess functions for DXPR GridStack module.

Code

function template_preprocess_dxpr_gridstack_gridstack_style(&$vars) {
  template_preprocess_views_view_unformatted($vars);
  $options = $vars['view']->style_plugin->options;
  $layout_data = $options['gridstack_layout_data'];
  $vars['layout_data'] = Json::decode($layout_data);
  if ($options['gridstack_overlay']) {
    $vars['classes'][] = 'sooperthemes-gridstack--' . $options['gridstack_overlay'];
  }
  if ($options['gridstack_zoom']) {
    $vars['classes'][] = 'sooperthemes-gridstack--zoom';
  }
  if ($options['gridstack_gap']) {
    $vars['gridstack_margin'] = 'style="margin: ' . round($options['gridstack_gap'] / 2, 2) . 'px"';
  }
  if ($options['gridstack_items_mobile']) {

    // -1 because $key counts from 0.
    $vars['gridstack_items_mobile'] = $options['gridstack_items_mobile'] - 1;
  }
  else {
    $vars['gridstack_items_mobile'] = 2;
  }
}