function template_preprocess_dxpr_gridstack_gridstack_plugin_style in DXPR GridStack 7
Implementation of template preprocess for the view.
File
- templates/
dxpr_gridstack/ theme.inc, line 6
Code
function template_preprocess_dxpr_gridstack_gridstack_plugin_style(&$vars) {
$view = $vars['view'];
$options = $view->style_plugin->options;
$layout_data = $options['gridstack_layout_data'];
$vars['layout_data'] = drupal_json_decode($layout_data);
if ($options['gridstack_overlay']) {
$vars['classes_array'][] = 'dxpr-gridstack--' . $options['gridstack_overlay'];
}
if ($options['gridstack_zoom']) {
$vars['classes_array'][] = 'dxpr-gridstack--zoom';
}
if (!empty($options['gridstack_gap'])) {
$vars['gridstack_margin'] = 'style="margin: ' . round($options['gridstack_gap'] / 2, 2) . 'px"';
}
if (!empty($options['gridstack_items_mobile'])) {
$vars['gridstack_items_mobile'] = $options['gridstack_items_mobile'] - 1;
// -1 because $key counts from 0
}
else {
$vars['gridstack_items_mobile'] = 2;
}
drupal_add_library('dxpr_gridstack', 'dxpr_gridstack_lib');
}