views_photo_grid.module in Views Photo Grid 8
Same filename and directory in other branches
Module file for the Views Photo Grid module.
File
views_photo_grid.moduleView source
<?php
/**
* @file
* Module file for the Views Photo Grid module.
*/
/**
* Preprocesses variables for the photo grid template.
*/
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';
}
Functions
Name | Description |
---|---|
template_preprocess_views_photo_grid_style | Preprocesses variables for the photo grid template. |