Skip to content

Commit 163d4cc

Browse files
author
gwharton
committed
[2.3-develop] [ForwardPort] Port of #15020 Update Gallery Template to handle boolean config Variables
Due to changes implemented in the resolution to #12285, boolean configuration variables are now properly typed booleans, instead of the strings "true" and "false". Without this fix applied, config vals that were true were being output in the gallery template javascript as : 1 and values that were false were being output as : This causes javascript errors for any item that is set to false.
1 parent 4f9b705 commit 163d4cc

File tree

1 file changed

+10
-30
lines changed
  • app/code/Magento/Catalog/view/frontend/templates/product/view

1 file changed

+10
-30
lines changed

app/code/Magento/Catalog/view/frontend/templates/product/view/gallery.phtml

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,11 @@
4747
"data": <?= /* @escapeNotVerified */ $block->getGalleryImagesJson() ?>,
4848
"options": {
4949
"nav": "<?= /* @escapeNotVerified */ $block->getVar("gallery/nav") ?>",
50-
<?php if (($block->getVar("gallery/loop"))): ?>
51-
"loop": <?= /* @escapeNotVerified */ $block->getVar("gallery/loop") ?>,
52-
<?php endif; ?>
53-
<?php if (($block->getVar("gallery/keyboard"))): ?>
54-
"keyboard": <?= /* @escapeNotVerified */ $block->getVar("gallery/keyboard") ?>,
55-
<?php endif; ?>
56-
<?php if (($block->getVar("gallery/arrows"))): ?>
57-
"arrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/arrows") ?>,
58-
<?php endif; ?>
59-
<?php if (($block->getVar("gallery/allowfullscreen"))): ?>
60-
"allowfullscreen": <?= /* @escapeNotVerified */ $block->getVar("gallery/allowfullscreen") ?>,
61-
<?php endif; ?>
62-
<?php if (($block->getVar("gallery/caption"))): ?>
63-
"showCaption": <?= /* @escapeNotVerified */ $block->getVar("gallery/caption") ?>,
64-
<?php endif; ?>
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' ?>,
6555
"width": "<?= /* @escapeNotVerified */ $block->getImageAttribute('product_page_image_medium', 'width') ?>",
6656
"thumbwidth": "<?= /* @escapeNotVerified */ $block->getImageAttribute('product_page_image_small', 'width') ?>",
6757
<?php if ($block->getImageAttribute('product_page_image_small', 'height') || $block->getImageAttribute('product_page_image_small', 'width')): ?>
@@ -76,28 +66,18 @@
7666
"transitionduration": <?= /* @escapeNotVerified */ $block->getVar("gallery/transition/duration") ?>,
7767
<?php endif; ?>
7868
"transition": "<?= /* @escapeNotVerified */ $block->getVar("gallery/transition/effect") ?>",
79-
<?php if (($block->getVar("gallery/navarrows"))): ?>
80-
"navarrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/navarrows") ?>,
81-
<?php endif; ?>
69+
"navarrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/navarrows") ? 'true' : 'false' ?>,
8270
"navtype": "<?= /* @escapeNotVerified */ $block->getVar("gallery/navtype") ?>",
8371
"navdir": "<?= /* @escapeNotVerified */ $block->getVar("gallery/navdir") ?>"
8472
},
8573
"fullscreen": {
8674
"nav": "<?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/nav") ?>",
87-
<?php if ($block->getVar("gallery/fullscreen/loop")): ?>
88-
"loop": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/loop") ?>,
89-
<?php endif; ?>
75+
"loop": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/loop") ? 'true' : 'false' ?>,
9076
"navdir": "<?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/navdir") ?>",
91-
<?php if ($block->getVar("gallery/transition/navarrows")): ?>
92-
"navarrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/navarrows") ?>,
93-
<?php endif; ?>
77+
"navarrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/navarrows") ? 'true' : 'false' ?>,
9478
"navtype": "<?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/navtype") ?>",
95-
<?php if ($block->getVar("gallery/fullscreen/arrows")): ?>
96-
"arrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/arrows") ?>,
97-
<?php endif; ?>
98-
<?php if ($block->getVar("gallery/fullscreen/caption")): ?>
99-
"showCaption": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/caption") ?>,
100-
<?php endif; ?>
79+
"arrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/arrows") ? 'true' : 'false' ?>,
80+
"showCaption": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/caption") ? 'true' : 'false' ?>,
10181
<?php if ($block->getVar("gallery/fullscreen/transition/duration")): ?>
10282
"transitionduration": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/transition/duration") ?>,
10383
<?php endif; ?>

0 commit comments

Comments
 (0)