function template_preprocess_views_photo_grid_style in Views Photo Grid 8
Same name and namespace in other branches
- 7 views_photo_grid.module \template_preprocess_views_photo_grid_style()
Preprocesses variables for the photo grid template.
File
- ./
views_photo_grid.module, line 11 - Module file for the Views Photo Grid module.
Code
function template_preprocess_views_photo_grid_style(&$vars) {
$view = $vars['view'];
$handler = $view->style_plugin;
$image_field = $handler
->get_image_field_name();
if (!$image_field) {
return;
}
$vars['items'] = array();
foreach ($view->result as $key => $row) {
$vars['items'][] = $handler
->getField($key, $image_field);
}
$vars['#attached']['drupalSettings']['viewsPhotoGrid']['gridPadding'] = $handler->options['grid_padding'];
$vars['#attached']['library'][] = 'views_photo_grid/views_photo_grid';
}