6
6
7
7
namespace Magento \Theme \Block \Html ;
8
8
9
+ use Magento \Framework \App \ObjectManager ;
9
10
use Magento \Framework \Escaper ;
11
+ use Magento \Framework \View \Element \Template ;
12
+ use Magento \Framework \View \Element \Template \Context ;
13
+ use Magento \Store \Model \ScopeInterface ;
10
14
11
15
/**
12
16
* Html page header block
13
17
*
14
18
* @api
15
19
* @since 100.0.2
16
20
*/
17
- class Header extends \ Magento \ Framework \ View \ Element \ Template
21
+ class Header extends Template
18
22
{
19
23
/**
20
24
* @var Escaper
21
25
*/
22
26
private $ escaper ;
23
27
24
28
/**
25
- * Constructor
26
- *
27
- * @param \Magento\Framework\View\Element\Template\Context $context
28
- * @param Magento\Framework\Escaper $escaper
29
+ * @param Context $context
29
30
* @param array $data
31
+ * @param Escaper|null $escaper
30
32
*/
31
33
public function __construct (
32
- \ Magento \ Framework \ View \ Element \ Template \ Context $ context ,
33
- \ Magento \ Framework \ Escaper $ escaper ,
34
- array $ data = []
34
+ Context $ context ,
35
+ array $ data = [] ,
36
+ Escaper $ escaper = null
35
37
) {
36
- $ this ->escaper = $ escaper ;
37
38
parent ::__construct ($ context , $ data );
39
+ $ this ->escaper = $ escaper ?: ObjectManager::getInstance ()->get (Escaper::class);;
38
40
}
39
41
40
42
/**
@@ -54,7 +56,7 @@ public function getWelcome()
54
56
if (empty ($ this ->_data ['welcome ' ])) {
55
57
$ this ->_data ['welcome ' ] = $ this ->_scopeConfig ->getValue (
56
58
'design/header/welcome ' ,
57
- \ Magento \ Store \ Model \ ScopeInterface::SCOPE_STORE
59
+ ScopeInterface::SCOPE_STORE
58
60
);
59
61
}
60
62
$ this ->_data ['welcome ' ] = $ this ->escaper ->escapeQuote ($ this ->_data ['welcome ' ], true );
0 commit comments