@@ -57,7 +57,7 @@ abstract class AbstractTemplate extends AbstractModel implements TemplateTypesIn
57
57
*
58
58
* @var \Magento\Framework\Object
59
59
*/
60
- protected $ _designConfig ;
60
+ private $ designConfig ;
61
61
62
62
/**
63
63
* Whether template is child of another template
@@ -78,21 +78,21 @@ abstract class AbstractTemplate extends AbstractModel implements TemplateTypesIn
78
78
*
79
79
* @var \Magento\Framework\Object|boolean
80
80
*/
81
- protected $ _emulatedDesignConfig = false ;
81
+ private $ emulatedDesignConfig = false ;
82
82
83
83
/**
84
84
* Package area
85
85
*
86
86
* @var string
87
87
*/
88
- protected $ _area ;
88
+ private $ area ;
89
89
90
90
/**
91
91
* Store id
92
92
*
93
93
* @var int
94
94
*/
95
- protected $ _store ;
95
+ private $ store ;
96
96
97
97
/**
98
98
* Tracks whether design has been applied within the context of this template model. Important as there are multiple
@@ -105,50 +105,43 @@ abstract class AbstractTemplate extends AbstractModel implements TemplateTypesIn
105
105
/**
106
106
* @var \Magento\Email\Model\TemplateFactory
107
107
*/
108
- private $ templateFactory = null ;
108
+ protected $ templateFactory = null ;
109
109
110
110
/**
111
111
* Design package instance
112
112
*
113
113
* @var \Magento\Framework\View\DesignInterface
114
114
*/
115
- protected $ _design = null ;
115
+ protected $ design = null ;
116
116
117
117
/**
118
118
* @var \Magento\Store\Model\App\Emulation
119
119
*/
120
- protected $ _appEmulation ;
120
+ protected $ appEmulation ;
121
121
122
122
/**
123
123
* @var \Magento\Store\Model\StoreManagerInterface
124
124
*/
125
- private $ storeManager ;
125
+ protected $ storeManager ;
126
126
127
127
/**
128
128
* Asset service
129
129
*
130
130
* @var \Magento\Framework\View\Asset\Repository
131
131
*/
132
- private $ assetRepo ;
132
+ protected $ assetRepo ;
133
133
134
134
/**
135
135
* @var \Magento\Framework\Filesystem
136
136
*/
137
- private $ filesystem ;
137
+ protected $ filesystem ;
138
138
139
139
/**
140
140
* Scope config
141
141
*
142
142
* @var \Magento\Framework\App\Config\ScopeConfigInterface
143
143
*/
144
- protected $ _scopeConfig ;
145
-
146
- /**
147
- * Object manager
148
- *
149
- * @var \Magento\Framework\ObjectManagerInterface
150
- */
151
- private $ objectManager ;
144
+ protected $ scopeConfig ;
152
145
153
146
/**
154
147
* @var \Magento\Email\Model\Template\Config
@@ -164,8 +157,6 @@ abstract class AbstractTemplate extends AbstractModel implements TemplateTypesIn
164
157
* @param \Magento\Framework\View\Asset\Repository $assetRepo
165
158
* @param \Magento\Framework\Filesystem $filesystem
166
159
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
167
- * @param \Magento\Framework\ObjectManagerInterface $objectManager
168
- * @param \Magento\Framework\ObjectManagerInterface $objectManager
169
160
* @param Template\Config $emailConfig
170
161
* @param \Magento\Email\Model\TemplateFactory $templateFactory
171
162
* @param array $data
@@ -181,20 +172,18 @@ public function __construct(
181
172
\Magento \Framework \View \Asset \Repository $ assetRepo ,
182
173
\Magento \Framework \Filesystem $ filesystem ,
183
174
\Magento \Framework \App \Config \ScopeConfigInterface $ scopeConfig ,
184
- \Magento \Framework \ObjectManagerInterface $ objectManager ,
185
175
Template \Config $ emailConfig ,
186
176
TemplateFactory $ templateFactory ,
187
177
array $ data = []
188
178
) {
189
- $ this ->_design = $ design ;
190
- $ this ->_area = isset ($ data ['area ' ]) ? $ data ['area ' ] : null ;
191
- $ this ->_store = isset ($ data ['store ' ]) ? $ data ['store ' ] : null ;
192
- $ this ->_appEmulation = $ appEmulation ;
179
+ $ this ->design = $ design ;
180
+ $ this ->area = isset ($ data ['area ' ]) ? $ data ['area ' ] : null ;
181
+ $ this ->store = isset ($ data ['store ' ]) ? $ data ['store ' ] : null ;
182
+ $ this ->appEmulation = $ appEmulation ;
193
183
$ this ->storeManager = $ storeManager ;
194
184
$ this ->assetRepo = $ assetRepo ;
195
185
$ this ->filesystem = $ filesystem ;
196
- $ this ->_scopeConfig = $ scopeConfig ;
197
- $ this ->objectManager = $ objectManager ;
186
+ $ this ->scopeConfig = $ scopeConfig ;
198
187
$ this ->emailConfig = $ emailConfig ;
199
188
$ this ->templateFactory = $ templateFactory ;
200
189
parent ::__construct ($ context , $ registry , null , null , $ data );
@@ -244,7 +233,7 @@ protected function getTemplateInstance()
244
233
*/
245
234
public function loadByConfigPath ($ configPath )
246
235
{
247
- $ templateId = $ this ->_scopeConfig ->getValue (
236
+ $ templateId = $ this ->scopeConfig ->getValue (
248
237
$ configPath ,
249
238
ScopeInterface::SCOPE_STORE ,
250
239
$ this ->getDesignConfig ()->getStore ()
@@ -393,7 +382,7 @@ public function getDefaultEmailLogo()
393
382
protected function getLogoUrl ($ store )
394
383
{
395
384
$ store = $ this ->storeManager ->getStore ($ store );
396
- $ fileName = $ this ->_scopeConfig ->getValue (
385
+ $ fileName = $ this ->scopeConfig ->getValue (
397
386
self ::XML_PATH_DESIGN_EMAIL_LOGO ,
398
387
ScopeInterface::SCOPE_STORE ,
399
388
$ store
@@ -419,7 +408,7 @@ protected function getLogoUrl($store)
419
408
protected function getLogoAlt ($ store )
420
409
{
421
410
$ store = $ this ->storeManager ->getStore ($ store );
422
- $ alt = $ this ->_scopeConfig ->getValue (
411
+ $ alt = $ this ->scopeConfig ->getValue (
423
412
self ::XML_PATH_DESIGN_EMAIL_LOGO_ALT ,
424
413
ScopeInterface::SCOPE_STORE ,
425
414
$ store
@@ -453,35 +442,35 @@ protected function addEmailVariables($variables, $storeId)
453
442
$ variables ['logo_alt ' ] = $ this ->getLogoAlt ($ storeId );
454
443
}
455
444
if (!isset ($ variables ['logo_width ' ])) {
456
- $ variables ['logo_width ' ] = $ this ->_scopeConfig ->getValue (
445
+ $ variables ['logo_width ' ] = $ this ->scopeConfig ->getValue (
457
446
self ::XML_PATH_DESIGN_EMAIL_LOGO_WIDTH ,
458
447
ScopeInterface::SCOPE_STORE ,
459
448
$ store
460
449
);
461
450
}
462
451
if (!isset ($ variables ['logo_height ' ])) {
463
- $ variables ['logo_height ' ] = $ this ->_scopeConfig ->getValue (
452
+ $ variables ['logo_height ' ] = $ this ->scopeConfig ->getValue (
464
453
self ::XML_PATH_DESIGN_EMAIL_LOGO_HEIGHT ,
465
454
ScopeInterface::SCOPE_STORE ,
466
455
$ store
467
456
);
468
457
}
469
458
if (!isset ($ variables ['store_phone ' ])) {
470
- $ variables ['store_phone ' ] = $ this ->_scopeConfig ->getValue (
459
+ $ variables ['store_phone ' ] = $ this ->scopeConfig ->getValue (
471
460
\Magento \Store \Model \Store::XML_PATH_STORE_STORE_PHONE ,
472
461
ScopeInterface::SCOPE_STORE ,
473
462
$ store
474
463
);
475
464
}
476
465
if (!isset ($ variables ['store_hours ' ])) {
477
- $ variables ['store_hours ' ] = $ this ->_scopeConfig ->getValue (
466
+ $ variables ['store_hours ' ] = $ this ->scopeConfig ->getValue (
478
467
\Magento \Store \Model \Store::XML_PATH_STORE_STORE_HOURS ,
479
468
ScopeInterface::SCOPE_STORE ,
480
469
$ store
481
470
);
482
471
}
483
472
if (!isset ($ variables ['store_email ' ])) {
484
- $ variables ['store_email ' ] = $ this ->_scopeConfig ->getValue (
473
+ $ variables ['store_email ' ] = $ this ->scopeConfig ->getValue (
485
474
'trans_email/ident_support/email ' ,
486
475
ScopeInterface::SCOPE_STORE ,
487
476
$ store
@@ -514,7 +503,7 @@ protected function applyDesignConfig()
514
503
if ($ storeId !== null ) {
515
504
// Force emulation in case email is being sent from same store so that theme will be loaded. Helpful
516
505
// for situations where emails may be sent from bootstrap files that load frontend store, but not theme
517
- $ this ->_appEmulation ->startEnvironmentEmulation ($ storeId , $ area , true );
506
+ $ this ->appEmulation ->startEnvironmentEmulation ($ storeId , $ area , true );
518
507
}
519
508
return true ;
520
509
}
@@ -526,7 +515,7 @@ protected function applyDesignConfig()
526
515
*/
527
516
protected function cancelDesignConfig ()
528
517
{
529
- $ this ->_appEmulation ->stopEnvironmentEmulation ();
518
+ $ this ->appEmulation ->stopEnvironmentEmulation ();
530
519
$ this ->hasDesignBeenApplied = false ;
531
520
return $ this ;
532
521
}
@@ -542,9 +531,9 @@ public function getDesignParams()
542
531
// Retrieve area from getDesignConfig, rather than the getDesignTheme->getArea(), as the latter doesn't
543
532
// return the emulated area
544
533
'area ' => $ this ->getDesignConfig ()->getArea (),
545
- 'theme ' => $ this ->_design ->getDesignTheme ()->getCode (),
546
- 'themeModel ' => $ this ->_design ->getDesignTheme (),
547
- 'locale ' => $ this ->_design ->getLocale (),
534
+ 'theme ' => $ this ->design ->getDesignTheme ()->getCode (),
535
+ 'themeModel ' => $ this ->design ->getDesignTheme (),
536
+ 'locale ' => $ this ->design ->getLocale (),
548
537
];
549
538
}
550
539
@@ -555,18 +544,18 @@ public function getDesignParams()
555
544
*/
556
545
public function getDesignConfig ()
557
546
{
558
- if ($ this ->_designConfig === null ) {
559
- if ($ this ->_area === null ) {
560
- $ this ->_area = $ this ->_design ->getArea ();
547
+ if ($ this ->designConfig === null ) {
548
+ if ($ this ->area === null ) {
549
+ $ this ->area = $ this ->design ->getArea ();
561
550
}
562
- if ($ this ->_store === null ) {
563
- $ this ->_store = $ this ->storeManager ->getStore ()->getId ();
551
+ if ($ this ->store === null ) {
552
+ $ this ->store = $ this ->storeManager ->getStore ()->getId ();
564
553
}
565
- $ this ->_designConfig = new \Magento \Framework \Object (
566
- ['area ' => $ this ->_area , 'store ' => $ this ->_store ]
554
+ $ this ->designConfig = new \Magento \Framework \Object (
555
+ ['area ' => $ this ->area , 'store ' => $ this ->store ]
567
556
);
568
557
}
569
- return $ this ->_designConfig ;
558
+ return $ this ->designConfig ;
570
559
}
571
560
572
561
/**
@@ -649,7 +638,7 @@ public function emulateDesign($storeId, $area = self::DEFAULT_DESIGN_AREA)
649
638
{
650
639
if ($ storeId ) {
651
640
// save current design settings
652
- $ this ->_emulatedDesignConfig = clone $ this ->getDesignConfig ();
641
+ $ this ->emulatedDesignConfig = clone $ this ->getDesignConfig ();
653
642
if (
654
643
$ this ->getDesignConfig ()->getStore () != $ storeId
655
644
|| $ this ->getDesignConfig ()->getArea () != $ area
@@ -658,7 +647,7 @@ public function emulateDesign($storeId, $area = self::DEFAULT_DESIGN_AREA)
658
647
$ this ->applyDesignConfig ();
659
648
}
660
649
} else {
661
- $ this ->_emulatedDesignConfig = false ;
650
+ $ this ->emulatedDesignConfig = false ;
662
651
}
663
652
}
664
653
@@ -669,10 +658,10 @@ public function emulateDesign($storeId, $area = self::DEFAULT_DESIGN_AREA)
669
658
*/
670
659
public function revertDesign ()
671
660
{
672
- if ($ this ->_emulatedDesignConfig ) {
673
- $ this ->setDesignConfig ($ this ->_emulatedDesignConfig ->getData ());
661
+ if ($ this ->emulatedDesignConfig ) {
662
+ $ this ->setDesignConfig ($ this ->emulatedDesignConfig ->getData ());
674
663
$ this ->cancelDesignConfig ();
675
- $ this ->_emulatedDesignConfig = false ;
664
+ $ this ->emulatedDesignConfig = false ;
676
665
}
677
666
}
678
667
0 commit comments