66
77namespace Magento \Theme \Block \Html ;
88
9+ use Magento \Framework \App \ObjectManager ;
910use Magento \Framework \Escaper ;
11+ use Magento \Framework \View \Element \Template ;
12+ use Magento \Framework \View \Element \Template \Context ;
13+ use Magento \Store \Model \ScopeInterface ;
1014
1115/**
1216 * Html page header block
1317 *
1418 * @api
1519 * @since 100.0.2
1620 */
17- class Header extends \ Magento \ Framework \ View \ Element \ Template
21+ class Header extends Template
1822{
1923 /**
2024 * @var Escaper
2125 */
2226 private $ escaper ;
2327
2428 /**
25- * Constructor
26- *
27- * @param \Magento\Framework\View\Element\Template\Context $context
28- * @param Magento\Framework\Escaper $escaper
29+ * @param Context $context
2930 * @param array $data
31+ * @param Escaper|null $escaper
3032 */
3133 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
3537 ) {
36- $ this ->escaper = $ escaper ;
3738 parent ::__construct ($ context , $ data );
39+ $ this ->escaper = $ escaper ?: ObjectManager::getInstance ()->get (Escaper::class);
3840 }
3941
4042 /**
@@ -54,7 +56,7 @@ public function getWelcome()
5456 if (empty ($ this ->_data ['welcome ' ])) {
5557 $ this ->_data ['welcome ' ] = $ this ->_scopeConfig ->getValue (
5658 'design/header/welcome ' ,
57- \ Magento \ Store \ Model \ ScopeInterface::SCOPE_STORE
59+ ScopeInterface::SCOPE_STORE
5860 );
5961 }
6062 $ this ->_data ['welcome ' ] = $ this ->escaper ->escapeQuote ($ this ->_data ['welcome ' ], true );
0 commit comments