@@ -348,8 +348,8 @@ public function getProcessedTemplate(array $variables = [])
348
348
}
349
349
$ processor ->setStoreId ($ storeId );
350
350
351
- // Populate the variables array with store, store info, logo, etc.
352
- $ variables + = $ this ->getEmailVariables ( $ storeId );
351
+ // Populate the variables array with store, store info, logo, etc. variables
352
+ $ variables = $ this ->addEmailVariables ( $ variables , $ storeId );
353
353
$ processor ->setVariables ($ variables );
354
354
355
355
try {
@@ -425,45 +425,62 @@ protected function getLogoAlt($store)
425
425
}
426
426
427
427
/**
428
- * Returns variables that are used by transactional and newsletter emails
428
+ * Add variables that are used by transactional and newsletter emails
429
429
*
430
+ * @param array $variables
430
431
* @param null|string|bool|int|\Magento\Store\Model\Store $storeId
431
432
* @return mixed
433
+ *
434
+ * @SuppressWarnings(PHPMD.CyclomaticComplexity)
435
+ * @SuppressWarnings(PHPMD.NPathComplexity)
432
436
*/
433
- protected function getEmailVariables ( $ storeId )
437
+ protected function addEmailVariables ( $ variables , $ storeId )
434
438
{
435
439
$ store = $ this ->storeManager ->getStore ($ storeId );
436
-
437
- $ variables = [
438
- 'store ' => $ store ,
439
- 'logo_url ' => $ this ->getLogoUrl ($ storeId ),
440
- 'logo_alt ' => $ this ->getLogoAlt ($ storeId ),
441
- 'logo_width ' => $ this ->scopeConfig ->getValue (
440
+ if (!isset ($ variables ['store ' ])) {
441
+ $ variables ['store ' ] = $ store ;
442
+ }
443
+ if (!isset ($ variables ['logo_url ' ])) {
444
+ $ variables ['logo_url ' ] = $ this ->getLogoUrl ($ storeId );
445
+ }
446
+ if (!isset ($ variables ['logo_alt ' ])) {
447
+ $ variables ['logo_alt ' ] = $ this ->getLogoAlt ($ storeId );
448
+ }
449
+ if (!isset ($ variables ['logo_width ' ])) {
450
+ $ variables ['logo_width ' ] = $ this ->scopeConfig ->getValue (
442
451
self ::XML_PATH_DESIGN_EMAIL_LOGO_WIDTH ,
443
452
ScopeInterface::SCOPE_STORE ,
444
453
$ store
445
- ),
446
- 'logo_height ' => $ this ->scopeConfig ->getValue (
454
+ );
455
+ }
456
+ if (!isset ($ variables ['logo_height ' ])) {
457
+ $ variables ['logo_height ' ] = $ this ->scopeConfig ->getValue (
447
458
self ::XML_PATH_DESIGN_EMAIL_LOGO_HEIGHT ,
448
459
ScopeInterface::SCOPE_STORE ,
449
460
$ store
450
- ),
451
- 'store_phone ' => $ this ->scopeConfig ->getValue (
461
+ );
462
+ }
463
+ if (!isset ($ variables ['store_phone ' ])) {
464
+ $ variables ['store_phone ' ] = $ this ->scopeConfig ->getValue (
452
465
\Magento \Store \Model \Store::XML_PATH_STORE_STORE_PHONE ,
453
466
ScopeInterface::SCOPE_STORE ,
454
467
$ store
455
- ),
456
- 'store_hours ' => $ this ->scopeConfig ->getValue (
468
+ );
469
+ }
470
+ if (!isset ($ variables ['store_hours ' ])) {
471
+ $ variables ['store_hours ' ] = $ this ->scopeConfig ->getValue (
457
472
\Magento \Store \Model \Store::XML_PATH_STORE_STORE_HOURS ,
458
473
ScopeInterface::SCOPE_STORE ,
459
474
$ store
460
- ),
461
- 'store_email ' => $ this ->scopeConfig ->getValue (
475
+ );
476
+ }
477
+ if (!isset ($ variables ['store_email ' ])) {
478
+ $ variables ['store_email ' ] = $ this ->scopeConfig ->getValue (
462
479
'trans_email/ident_support/email ' ,
463
480
ScopeInterface::SCOPE_STORE ,
464
481
$ store
465
- ),
466
- ];
482
+ );
483
+ }
467
484
// If template is text mode, don't include styles
468
485
if (!$ this ->isPlain () && !isset ($ variables ['template_styles ' ])) {
469
486
$ variables ['template_styles ' ] = $ this ->getTemplateStyles ();
0 commit comments