5
5
*/
6
6
namespace Magento \Customer \Block \Account ;
7
7
8
+ use Magento \Framework \App \ObjectManager ;
8
9
use Magento \Customer \Model \Form ;
9
10
use Magento \Store \Model \ScopeInterface ;
10
11
use Magento \Customer \Model \Context ;
12
+ use Magento \Framework \App \Http \Context as HttpContext ;
11
13
12
14
/**
13
15
* @api
@@ -25,21 +27,29 @@ class AuthenticationPopup extends \Magento\Framework\View\Element\Template
25
27
*/
26
28
private $ serializer ;
27
29
30
+ /**
31
+ * @var HttpContext
32
+ */
33
+ private $ httpContext ;
34
+
28
35
/**
29
36
* @param \Magento\Framework\View\Element\Template\Context $context
30
37
* @param array $data
31
38
* @param \Magento\Framework\Serialize\Serializer\Json|null $serializer
39
+ * @param HttpContext $httpContext
32
40
* @throws \RuntimeException
33
41
*/
34
42
public function __construct (
35
43
\Magento \Framework \View \Element \Template \Context $ context ,
36
44
array $ data = [],
37
- ?\Magento \Framework \Serialize \Serializer \Json $ serializer = null
45
+ ?\Magento \Framework \Serialize \Serializer \Json $ serializer = null ,
46
+ HttpContext $ httpContext = null
38
47
) {
39
48
parent ::__construct ($ context , $ data );
40
49
$ this ->jsLayout = isset ($ data ['jsLayout ' ]) && is_array ($ data ['jsLayout ' ]) ? $ data ['jsLayout ' ] : [];
41
50
$ this ->serializer = $ serializer ?: \Magento \Framework \App \ObjectManager::getInstance ()
42
51
->get (\Magento \Framework \Serialize \Serializer \Json::class);
52
+ $ this ->httpContext = $ httpContext ?: ObjectManager::getInstance ()->get (HttpContext::class);
43
53
}
44
54
45
55
/**
@@ -54,7 +64,7 @@ public function getJsLayout()
54
64
Form::XML_PATH_CUSTOMER_CAPTCHA_ENABLED ,
55
65
ScopeInterface::SCOPE_STORE
56
66
) && !$ this ->isLoggedIn ()) {
57
- if (isset ($ this ->jsLayout ['components ' ]['authenticationPopup ' ]['children ' ]['captcha ' ])) {
67
+ if (isset ($ this ->jsLayout ['components ' ]['authenticationPopup ' ]['children ' ]['captcha ' ])) {
58
68
unset($ this ->jsLayout ['components ' ]['authenticationPopup ' ]['children ' ]['captcha ' ]);
59
69
}
60
70
}
0 commit comments