11
11
use Magento \Customer \Model \Context as CustomerContext ;
12
12
use Magento \Framework \UrlInterface ;
13
13
use Magento \Framework \Locale \FormatInterface as LocaleFormat ;
14
+ use Magento \Framework \Data \Form \FormKey ;
14
15
15
16
/**
16
17
* Configuration provider for GiftMessage rendering on "Checkout cart" page.
@@ -49,6 +50,11 @@ class GiftMessageConfigProvider implements ConfigProviderInterface
49
50
*/
50
51
protected $ localeFormat ;
51
52
53
+ /**
54
+ * @var FormKey
55
+ */
56
+ protected $ formKey ;
57
+
52
58
/**
53
59
* @param \Magento\Framework\App\Helper\Context $context
54
60
* @param \Magento\GiftMessage\Api\CartRepositoryInterface $cartRepository
@@ -65,7 +71,8 @@ public function __construct(
65
71
\Magento \Checkout \Model \Session $ checkoutSession ,
66
72
HttpContext $ httpContext ,
67
73
\Magento \Store \Model \StoreManagerInterface $ storeManager ,
68
- LocaleFormat $ localeFormat
74
+ LocaleFormat $ localeFormat ,
75
+ FormKey $ formKey
69
76
) {
70
77
$ this ->scopeConfiguration = $ context ->getScopeConfig ();
71
78
$ this ->cartRepository = $ cartRepository ;
@@ -74,6 +81,7 @@ public function __construct(
74
81
$ this ->httpContext = $ httpContext ;
75
82
$ this ->storeManager = $ storeManager ;
76
83
$ this ->localeFormat = $ localeFormat ;
84
+ $ this -> formKey = $ formKey ;
77
85
}
78
86
79
87
/**
@@ -107,6 +115,7 @@ public function getConfig()
107
115
);
108
116
$ configuration ['storeCode ' ] = $ this ->getStoreCode ();
109
117
$ configuration ['isCustomerLoggedIn ' ] = $ this ->isCustomerLoggedIn ();
118
+ $ configuration ['formKey ' ] = $ this ->formKey ->getFormKey ();
110
119
$ store = $ this ->storeManager ->getStore ();
111
120
$ configuration ['baseUrl ' ] = $ store ->isFrontUrlSecure ()
112
121
? $ store ->getBaseUrl (UrlInterface::URL_TYPE_LINK , true )
0 commit comments