8
8
use Magento \Framework \Mail \Template \TransportBuilder ;
9
9
use Magento \Framework \Translate \Inline \StateInterface ;
10
10
use Magento \Store \Model \StoreManagerInterface ;
11
+ use Magento \Framework \App \ObjectManager ;
11
12
use Magento \Framework \App \Area ;
12
13
13
14
class Mail implements MailInterface
@@ -44,12 +45,13 @@ public function __construct(
44
45
ConfigInterface $ contactsConfig ,
45
46
TransportBuilder $ transportBuilder ,
46
47
StateInterface $ inlineTranslation ,
47
- StoreManagerInterface $ storeManager
48
+ StoreManagerInterface $ storeManager = null
48
49
) {
49
50
$ this ->contactsConfig = $ contactsConfig ;
50
51
$ this ->transportBuilder = $ transportBuilder ;
51
52
$ this ->inlineTranslation = $ inlineTranslation ;
52
- $ this ->storeManager = $ storeManager ;
53
+ $ this ->storeManager = $ storeManager ?:
54
+ ObjectManager::getInstance ()->get (StoreManagerInterface::class);
53
55
}
54
56
55
57
/**
@@ -70,7 +72,7 @@ public function send($replyTo, array $variables)
70
72
->setTemplateIdentifier ($ this ->contactsConfig ->emailTemplate ())
71
73
->setTemplateOptions (
72
74
[
73
- 'area ' => Area::AREA_FRONTEND ,
75
+ 'area ' => Area::AREA_FRONTEND ,
74
76
'store ' => $ this ->storeManager ->getStore ()->getId ()
75
77
]
76
78
)
0 commit comments