Skip to content

Commit 56a20b7

Browse files
author
Stanislav Idolov
authored
ENGCOM-1467: [2.2-develop] Transport variable can not be altered in email_invoice_set_template_vars_before Event #15040
2 parents 583b1f0 + ea2ea54 commit 56a20b7

File tree

2 files changed

+37
-13
lines changed

2 files changed

+37
-13
lines changed

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

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,21 @@
4747
"data": <?= /* @escapeNotVerified */ $block->getGalleryImagesJson() ?>,
4848
"options": {
4949
"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' ?>,
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; ?>
5565
"width": "<?= /* @escapeNotVerified */ $block->getImageAttribute('product_page_image_medium', 'width') ?>",
5666
"thumbwidth": "<?= /* @escapeNotVerified */ $block->getImageAttribute('product_page_image_small', 'width') ?>",
5767
<?php if ($block->getImageAttribute('product_page_image_small', 'height') || $block->getImageAttribute('product_page_image_small', 'width')): ?>
@@ -69,18 +79,28 @@
6979
"transitionduration": <?= /* @escapeNotVerified */ $block->getVar("gallery/transition/duration") ?>,
7080
<?php endif; ?>
7181
"transition": "<?= /* @escapeNotVerified */ $block->getVar("gallery/transition/effect") ?>",
72-
"navarrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/navarrows") ? 'true' : 'false' ?>,
82+
<?php if (($block->getVar("gallery/navarrows"))): ?>
83+
"navarrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/navarrows") ?>,
84+
<?php endif; ?>
7385
"navtype": "<?= /* @escapeNotVerified */ $block->getVar("gallery/navtype") ?>",
7486
"navdir": "<?= /* @escapeNotVerified */ $block->getVar("gallery/navdir") ?>"
7587
},
7688
"fullscreen": {
7789
"nav": "<?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/nav") ?>",
78-
"loop": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/loop") ? 'true' : 'false' ?>,
90+
<?php if ($block->getVar("gallery/fullscreen/loop")): ?>
91+
"loop": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/loop") ?>,
92+
<?php endif; ?>
7993
"navdir": "<?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/navdir") ?>",
80-
"navarrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/navarrows") ? 'true' : 'false' ?>,
94+
<?php if ($block->getVar("gallery/transition/navarrows")): ?>
95+
"navarrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/navarrows") ?>,
96+
<?php endif; ?>
8197
"navtype": "<?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/navtype") ?>",
82-
"arrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/arrows") ? 'true' : 'false' ?>,
83-
"showCaption": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/caption") ? 'true' : 'false' ?>,
98+
<?php if ($block->getVar("gallery/fullscreen/arrows")): ?>
99+
"arrows": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/arrows") ?>,
100+
<?php endif; ?>
101+
<?php if ($block->getVar("gallery/fullscreen/caption")): ?>
102+
"showCaption": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/caption") ?>,
103+
<?php endif; ?>
84104
<?php if ($block->getVar("gallery/fullscreen/transition/duration")): ?>
85105
"transitionduration": <?= /* @escapeNotVerified */ $block->getVar("gallery/fullscreen/transition/duration") ?>,
86106
<?php endif; ?>

app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Magento\Sales\Model\ResourceModel\Order as OrderResource;
1414
use Magento\Sales\Model\Order\Address\Renderer;
1515
use Magento\Framework\Event\ManagerInterface;
16+
use Magento\Framework\DataObject;
1617

1718
/**
1819
* Class OrderSender
@@ -130,14 +131,17 @@ protected function prepareTemplate(Order $order)
130131
'formattedShippingAddress' => $this->getFormattedShippingAddress($order),
131132
'formattedBillingAddress' => $this->getFormattedBillingAddress($order),
132133
];
133-
$transport = new \Magento\Framework\DataObject($transport);
134+
$transportObject = new DataObject($transport);
134135

136+
/**
137+
* Event argument `transport` is @deprecated. Use `transportObject` instead.
138+
*/
135139
$this->eventManager->dispatch(
136140
'email_order_set_template_vars_before',
137-
['sender' => $this, 'transport' => $transport]
141+
['sender' => $this, 'transport' => $transportObject->getData(), 'transportObject' => $transportObject]
138142
);
139143

140-
$this->templateContainer->setTemplateVars($transport->getData());
144+
$this->templateContainer->setTemplateVars($transportObject->getData());
141145

142146
parent::prepareTemplate($order);
143147
}

0 commit comments

Comments
 (0)