Skip to content

Commit 07d15f8

Browse files
authored
Merge pull request #7541 from magento-gl/L3_Arrows_PR_20220329
L3 arrows pr 20220329
2 parents 41631d5 + 294a4a2 commit 07d15f8

File tree

4 files changed

+40
-29
lines changed

4 files changed

+40
-29
lines changed

app/code/Magento/Email/Model/Template.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,21 @@ class Template extends AbstractTemplate implements \Magento\Framework\Mail\Templ
4545
* @deprecated
4646
* @see \Magento\Email\Model\Transport::XML_PATH_SENDING_SET_RETURN_PATH
4747
*/
48-
const XML_PATH_SENDING_SET_RETURN_PATH = 'system/smtp/set_return_path';
48+
public const XML_PATH_SENDING_SET_RETURN_PATH = 'system/smtp/set_return_path';
4949

5050
/**
5151
* Configuration path for custom Return-Path email
5252
* @deprecated
5353
* @see \Magento\Email\Model\Transport::XML_PATH_SENDING_RETURN_PATH_EMAIL
5454
*/
55-
const XML_PATH_SENDING_RETURN_PATH_EMAIL = 'system/smtp/return_path_email';
55+
public const XML_PATH_SENDING_RETURN_PATH_EMAIL = 'system/smtp/return_path_email';
5656

5757
/**
5858
* Config path to mail sending setting that shows if email communications are disabled
5959
* @deprecated
6060
* @see https://github.com/magento/magento2/issues/5988
6161
*/
62-
const XML_PATH_SYSTEM_SMTP_DISABLE = 'system/smtp/disable';
62+
public const XML_PATH_SYSTEM_SMTP_DISABLE = 'system/smtp/disable';
6363

6464
/**
6565
* BCC list
@@ -69,8 +69,6 @@ class Template extends AbstractTemplate implements \Magento\Framework\Mail\Templ
6969
protected $_bcc = [];
7070

7171
/**
72-
* Return path
73-
*
7472
* @var string
7573
*/
7674
protected $_returnPath = '';
@@ -253,7 +251,7 @@ public function getProcessedTemplateSubject(array $variables)
253251
);
254252

255253
try {
256-
$processedResult = $processor->setStoreId($storeId)->filter(__($this->getTemplateSubject())->render());
254+
$processedResult = $processor->setStoreId($storeId)->filter($this->getTemplateSubject());
257255
} catch (\Exception $e) {
258256
$this->cancelDesignConfig();
259257
throw new \Magento\Framework\Exception\MailException(__($e->getMessage()), $e);

app/code/Magento/Email/Model/Template/Filter.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
use Magento\Framework\Filter\Template\Tokenizer\Parameter;
2424
use Magento\Framework\Filter\VariableResolverInterface;
2525
use Magento\Framework\Stdlib\StringUtils;
26+
use Magento\Framework\Translate\Inline\StateInterface;
2627
use Magento\Framework\UrlInterface;
2728
use Magento\Framework\View\Asset\ContentProcessorException;
2829
use Magento\Framework\View\Asset\ContentProcessorInterface;
@@ -53,12 +54,12 @@ class Filter extends Template
5354
/**
5455
* The name used in the {{trans}} directive
5556
*/
56-
const TRANS_DIRECTIVE_NAME = 'trans';
57+
public const TRANS_DIRECTIVE_NAME = 'trans';
5758

5859
/**
5960
* The regex to match interior portion of a {{trans "foo"}} translation directive
6061
*/
61-
const TRANS_DIRECTIVE_REGEX = '/^\s*([\'"])([^\1]*?)(?<!\\\)\1(\s.*)?$/si';
62+
public const TRANS_DIRECTIVE_REGEX = '/^\s*([\'"])([^\1]*?)(?<!\\\)\1(\s.*)?$/si';
6263

6364
/**
6465
* @var bool
@@ -119,8 +120,6 @@ class Filter extends Template
119120

120121
/**
121122
* Core store config
122-
* Variable factory
123-
*
124123
* @var VariableFactory
125124
*/
126125
protected $_variableFactory;
@@ -190,6 +189,11 @@ class Filter extends Template
190189
*/
191190
private $storeInformation;
192191

192+
/**
193+
* @var StateInterface
194+
*/
195+
private $inlineTranslationState;
196+
193197
/**
194198
* Filter constructor.
195199
* @param StringUtils $string
@@ -211,6 +215,7 @@ class Filter extends Template
211215
* @param array $variables
212216
* @param array $directiveProcessors
213217
* @param StoreInformation|null $storeInformation
218+
* @param StateInterface|null $inlineTranslationState
214219
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
215220
*/
216221
public function __construct(
@@ -232,7 +237,8 @@ public function __construct(
232237
CssInliner $cssInliner,
233238
$variables = [],
234239
array $directiveProcessors = [],
235-
?StoreInformation $storeInformation = null
240+
?StoreInformation $storeInformation = null,
241+
StateInterface $inlineTranslationState = null
236242
) {
237243
$this->_escaper = $escaper;
238244
$this->_assetRepo = $assetRepo;
@@ -251,6 +257,8 @@ public function __construct(
251257
$this->configVariables = $configVariables;
252258
$this->storeInformation = $storeInformation ?:
253259
ObjectManager::getInstance()->get(StoreInformation::class);
260+
$this->inlineTranslationState = $inlineTranslationState ?:
261+
ObjectManager::getInstance()->get(StateInterface::class);
254262
parent::__construct($string, $variables, $directiveProcessors, $variableResolver);
255263
}
256264

@@ -616,8 +624,9 @@ public function transDirective($construction)
616624
if (empty($text)) {
617625
return '';
618626
}
619-
627+
$this->inlineTranslationState->disable();
620628
$text = __($text, $params)->render();
629+
$this->inlineTranslationState->enable();
621630
return $this->applyModifiers($text, $modifiers);
622631
}
623632

dev/tests/integration/testsuite/Magento/Email/Model/Template/FilterTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ public function layoutDirectiveDataProvider()
158158
* @param $expectedResult
159159
* @param array $variables
160160
* @internal param $translatorData
161+
* @magentoConfigFixture default_store dev/translate_inline/active 1
162+
* @magentoAppArea frontend
161163
* @dataProvider transDirectiveDataProvider
162164
*/
163165
public function testTransDirective($directive, $translations, $expectedResult, $variables = [])

lib/web/magnifier/magnifier.js

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -541,25 +541,27 @@
541541

542542
showWrapper = false;
543543
$(thumbObj).on('load', function () {
544-
data[idx].status = 1;
545-
546-
$(largeObj).on('load', function () {
547-
548-
if (largeObj.width > largeWrapper.width() || largeObj.height > largeWrapper.height()) {
549-
showWrapper = true;
550-
bindEvents(eventType, thumb);
551-
data[idx].status = 2;
552-
if (largeObj.width > largeObj.height) {
553-
data[idx].zoom = largeObj.width / largeWrapper.width();
554-
} else {
555-
data[idx].zoom = largeObj.height / largeWrapper.height();
544+
if (data.length > 0) {
545+
data[idx].status = 1;
546+
547+
$(largeObj).on('load', function () {
548+
549+
if (largeObj.width > largeWrapper.width() || largeObj.height > largeWrapper.height()) {
550+
showWrapper = true;
551+
bindEvents(eventType, thumb);
552+
data[idx].status = 2;
553+
if (largeObj.width > largeObj.height) {
554+
data[idx].zoom = largeObj.width / largeWrapper.width();
555+
} else {
556+
data[idx].zoom = largeObj.height / largeWrapper.height();
557+
}
558+
setThumbData(thumb, data[idx]);
559+
updateLensOnLoad(idx, thumb, largeObj, largeWrapper);
556560
}
557-
setThumbData(thumb, data[idx]);
558-
updateLensOnLoad(idx, thumb, largeObj, largeWrapper);
559-
}
560-
});
561+
});
561562

562-
largeObj.src = data[idx].largeUrl;
563+
largeObj.src = data[idx].largeUrl;
564+
}
563565
});
564566

565567
thumbObj.src = thumb.src;

0 commit comments

Comments
 (0)