Skip to content

Commit

Permalink
[2.3-develop] [ForwardPort] Port of #15020 Update Gallery Template to…
Browse files Browse the repository at this point in the history
… 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.
  • Loading branch information
gwharton committed May 5, 2018
1 parent 4f9b705 commit 163d4cc
Showing 1 changed file with 10 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,11 @@
"data": <?= /* @escapeNotVerified */ $block->getGalleryImagesJson() ?>,
"options": {
"nav": "<?= /* @escapeNotVerified */ $block->getVar("gallery/nav") ?>",
<?php if (($block->getVar("gallery/loop"))): ?>
"loop": <?= /* @escapeNotVerified */ $block->getVar("gallery/loop") ?>,
<?php endif; ?>
<?php if (($block->getVar("gallery/keyboard"))): ?>
"keyboard": <?= /* @escapeNotVerified */ $block->getVar("gallery/keyboard") ?>,
<?php endif; ?>
<?php if (($block->getVar("gallery/arrows"))): ?>
"arrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/arrows") ?>,
<?php endif; ?>
<?php if (($block->getVar("gallery/allowfullscreen"))): ?>
"allowfullscreen": <?= /* @escapeNotVerified */ $block->getVar("gallery/allowfullscreen") ?>,
<?php endif; ?>
<?php if (($block->getVar("gallery/caption"))): ?>
"showCaption": <?= /* @escapeNotVerified */ $block->getVar("gallery/caption") ?>,
<?php endif; ?>
"loop": <?= /* @escapeNotVerified */ $block->getVar("gallery/loop") ? 'true' : 'false' ?>,
"keyboard": <?= /* @escapeNotVerified */ $block->getVar("gallery/keyboard") ? 'true' : 'false' ?>,
"arrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/arrows") ? 'true' : 'false' ?>,
"allowfullscreen": <?= /* @escapeNotVerified */ $block->getVar("gallery/allowfullscreen") ? 'true' : 'false' ?>,
"showCaption": <?= /* @escapeNotVerified */ $block->getVar("gallery/caption") ? 'true' : 'false' ?>,
"width": "<?= /* @escapeNotVerified */ $block->getImageAttribute('product_page_image_medium', 'width') ?>",
"thumbwidth": "<?= /* @escapeNotVerified */ $block->getImageAttribute('product_page_image_small', 'width') ?>",
<?php if ($block->getImageAttribute('product_page_image_small', 'height') || $block->getImageAttribute('product_page_image_small', 'width')): ?>
Expand All @@ -76,28 +66,18 @@
"transitionduration": <?= /* @escapeNotVerified */ $block->getVar("gallery/transition/duration") ?>,
<?php endif; ?>
"transition": "<?= /* @escapeNotVerified */ $block->getVar("gallery/transition/effect") ?>",
<?php if (($block->getVar("gallery/navarrows"))): ?>
"navarrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/navarrows") ?>,
<?php endif; ?>
"navarrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/navarrows") ? 'true' : 'false' ?>,
"navtype": "<?= /* @escapeNotVerified */ $block->getVar("gallery/navtype") ?>",
"navdir": "<?= /* @escapeNotVerified */ $block->getVar("gallery/navdir") ?>"
},
"fullscreen": {
"nav": "<?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/nav") ?>",
<?php if ($block->getVar("gallery/fullscreen/loop")): ?>
"loop": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/loop") ?>,
<?php endif; ?>
"loop": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/loop") ? 'true' : 'false' ?>,
"navdir": "<?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/navdir") ?>",
<?php if ($block->getVar("gallery/transition/navarrows")): ?>
"navarrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/navarrows") ?>,
<?php endif; ?>
"navarrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/navarrows") ? 'true' : 'false' ?>,
"navtype": "<?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/navtype") ?>",
<?php if ($block->getVar("gallery/fullscreen/arrows")): ?>
"arrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/arrows") ?>,
<?php endif; ?>
<?php if ($block->getVar("gallery/fullscreen/caption")): ?>
"showCaption": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/caption") ?>,
<?php endif; ?>
"arrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/arrows") ? 'true' : 'false' ?>,
"showCaption": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/caption") ? 'true' : 'false' ?>,
<?php if ($block->getVar("gallery/fullscreen/transition/duration")): ?>
"transitionduration": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/transition/duration") ?>,
<?php endif; ?>
Expand Down

0 comments on commit 163d4cc

Please sign in to comment.