You are here

views_photo_grid.module in Views Photo Grid 8

Same filename and directory in other branches
  1. 7 views_photo_grid.module

Module file for the Views Photo Grid module.

File

views_photo_grid.module
View 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

Namesort descending Description
template_preprocess_views_photo_grid_style Preprocesses variables for the photo grid template.