Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
gallery.phtml
Go to the documentation of this file.
1 <?php
7 // @codingStandardsIgnoreFile
8 
14 ?>
15 <div class="gallery-placeholder _block-content-loading" data-gallery-role="gallery-placeholder">
16  <div data-role="loader" class="loading-mask">
17  <div class="loader">
18  <img src="<?= /* @escapeNotVerified */ $block->getViewFileUrl('images/loader-1.gif') ?>"
19  alt="<?= /* @escapeNotVerified */ __('Loading...') ?>">
20  </div>
21  </div>
22 </div>
23 <!--Fix for jumping content. Loader must be the same size as gallery.-->
24 <script>
25  var config = {
26  "width": <?= /* @escapeNotVerified */ $block->getImageAttribute('product_page_image_medium', 'width') ?>,
27  "thumbheight": <?php /* @escapeNotVerified */ echo $block->getImageAttribute('product_page_image_small', 'height')
28  ?: $block->getImageAttribute('product_page_image_small', 'width'); ?>,
29  "navtype": "<?= /* @escapeNotVerified */ $block->getVar("gallery/navtype") ?>",
30  "height": <?= /* @escapeNotVerified */ $block->getImageAttribute('product_page_image_medium', 'height') ?>
31  },
32  thumbBarHeight = 0,
33  loader = document.querySelectorAll('[data-gallery-role="gallery-placeholder"] [data-role="loader"]')[0];
34 
35  if (config.navtype === 'horizontal') {
36  thumbBarHeight = config.thumbheight;
37  }
38 
39  loader.style.paddingBottom = ( config.height / config.width * 100) + "%";
40 </script>
41 <script type="text/x-magento-init">
42  {
43  "[data-gallery-role=gallery-placeholder]": {
44  "mage/gallery/gallery": {
45  "mixins":["magnifier/magnify"],
46  "magnifierOpts": <?= /* @escapeNotVerified */ $block->getMagnifier() ?>,
47  "data": <?= /* @escapeNotVerified */ $block->getGalleryImagesJson() ?>,
48  "options": {
49  "nav": "<?= /* @escapeNotVerified */ $block->getVar("gallery/nav") ?>",
50  "loop": <?= /* @escapeNotVerified */ $block->getVar("gallery/loop") ? 'true' : 'false' ?>,
51  "keyboard": <?= /* @escapeNotVerified */ $block->getVar("gallery/keyboard") ? 'true' : 'false' ?>,
52  "arrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/arrows") ? 'true' : 'false' ?>,
53  "allowfullscreen": <?= /* @escapeNotVerified */ $block->getVar("gallery/allowfullscreen") ? 'true' : 'false' ?>,
54  "showCaption": <?= /* @escapeNotVerified */ $block->getVar("gallery/caption") ? 'true' : 'false' ?>,
55  "width": "<?= /* @escapeNotVerified */ $block->getImageAttribute('product_page_image_medium', 'width') ?>",
56  "thumbwidth": "<?= /* @escapeNotVerified */ $block->getImageAttribute('product_page_image_small', 'width') ?>",
57  <?php if ($block->getImageAttribute('product_page_image_small', 'height') || $block->getImageAttribute('product_page_image_small', 'width')): ?>
58  "thumbheight": <?php /* @escapeNotVerified */ echo $block->getImageAttribute('product_page_image_small', 'height')
59  ?: $block->getImageAttribute('product_page_image_small', 'width'); ?>,
60  <?php endif; ?>
61  <?php if ($block->getImageAttribute('product_page_image_medium', 'height') || $block->getImageAttribute('product_page_image_medium', 'width')): ?>
62  "height": <?php /* @escapeNotVerified */ echo $block->getImageAttribute('product_page_image_medium', 'height')
63  ?: $block->getImageAttribute('product_page_image_medium', 'width'); ?>,
64  <?php endif; ?>
65  <?php if ($block->getVar("gallery/transition/duration")): ?>
66  "transitionduration": <?= /* @escapeNotVerified */ $block->getVar("gallery/transition/duration") ?>,
67  <?php endif; ?>
68  "transition": "<?= /* @escapeNotVerified */ $block->getVar("gallery/transition/effect") ?>",
69  "navarrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/navarrows") ? 'true' : 'false' ?>,
70  "navtype": "<?= /* @escapeNotVerified */ $block->getVar("gallery/navtype") ?>",
71  "navdir": "<?= /* @escapeNotVerified */ $block->getVar("gallery/navdir") ?>"
72  },
73  "fullscreen": {
74  "nav": "<?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/nav") ?>",
75  "loop": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/loop") ? 'true' : 'false' ?>,
76  "navdir": "<?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/navdir") ?>",
77  "navarrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/navarrows") ? 'true' : 'false' ?>,
78  "navtype": "<?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/navtype") ?>",
79  "arrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/arrows") ? 'true' : 'false' ?>,
80  "showCaption": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/caption") ? 'true' : 'false' ?>,
81  <?php if ($block->getVar("gallery/fullscreen/transition/duration")): ?>
82  "transitionduration": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/transition/duration") ?>,
83  <?php endif; ?>
84  "transition": "<?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/transition/effect") ?>"
85  },
86  "breakpoints": <?= /* @escapeNotVerified */ $block->getBreakpoints() ?>
87  }
88  }
89  }
90 </script>
$block
Definition: block.php:8
endif
Definition: gallery.phtml:44