SproutCMS

This is the code documentation for the SproutCMS project

source of /sprout/views/image_gallery_tall_grid.php

  1. <?php
  2. /*
  3.  * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
  4.  * :tabSize=4:indentSize=4:noTabs=true:wrap=false:maxLineLen=120:mode=php:
  5.  *
  6.  * Copyright (C) 2015 Karmabunny Pty Ltd.
  7.  *
  8.  * This file is a part of SproutCMS.
  9.  *
  10.  * SproutCMS is free software: you can redistribute it and/or modify it under the terms
  11.  * of the GNU General Public License as published by the Free Software Foundation, either
  12.  * version 3 of the License, or (at your option) any later version.
  13.  *
  14.  * For more information, visit <http://getsproutcms.com>.
  15.  */
  16.  
  17. use Sprout\Helpers\Enc;
  18. use Sprout\Helpers\File;
  19. use Sprout\Helpers\Needs;
  20.  
  21.  
  22. Needs::fileGroup('magnific_popup');
  23.  
  24. // Create unique identifier to allow multiple on a page
  25. $unique = md5(microtime(true));
  26. ?>
  27.  
  28. <?php if (!empty($images) and count($images) > 0): ?>
  29. <div class="-clearfix image-gallery-side-wrap <?php if ($captions): ?>image-gallery-side-wrap--has-captions<?php endif; ?>">
  30. <?php foreach ($images as $image): ?>
  31. <?php if (!empty($image['filename']) and File::exists($image['filename'])): ?>
  32. <div class="image-gallery-side-thumb" <?php if ($idx++ > $num_thumbs): ?> style="display: none;" <?php endif; ?>>
  33. <a href="<?php echo Enc::html(File::resizeUrl($image['filename'], $config['full_size'])); ?>"
  34. <?php if ($captions): ?> title="<?php echo Enc::html($image['name'] . ' - ' . $image['description']); ?>"<?php endif; ?>
  35. class="image-gallery-side-thumb__link gallery-<?php echo Enc::html($unique); ?>">
  36. <img src="<?php echo Enc::html(File::resizeUrl($image['filename'], $config['thumb_size_5'] . '-' . $cropping)) ?>" alt="<?php echo Enc::html($image['name']); ?>">
  37. </a>
  38. </div>
  39. <?php endif; ?>
  40. <?php endforeach; ?>
  41. </div>
  42. <?php endif; ?>
  43.  
  44. <script type="text/javascript">
  45. if(jQuery().magnificPopup) {
  46. $('.gallery-<?php echo Enc::js($unique); ?>').magnificPopup({
  47. type: 'image',
  48. gallery: {
  49. enabled: true
  50. }
  51. });
  52. }
  53. </script>
  54.