File tree Expand file tree Collapse file tree 3 files changed +28
-6
lines changed Expand file tree Collapse file tree 3 files changed +28
-6
lines changed Original file line number Diff line number Diff line change 3
3
* Copyright © Magento, Inc. All rights reserved.
4
4
* See COPYING.txt for license details.
5
5
*/
6
-
6
+ declare (strict_types= 1 );
7
7
/**
8
8
* Frontend form key content block
9
9
*/
10
10
namespace Magento \Cookie \Block ;
11
11
12
+ use Magento \Framework \App \ObjectManager ;
13
+ use Magento \Framework \App \Config \ScopeConfigInterface ;
14
+
12
15
/**
13
16
* @api
14
17
* @since 100.0.2
18
+ *
19
+ * Class \Magento\Cookie\Block\RequireCookie
15
20
*/
16
21
class RequireCookie extends \Magento \Framework \View \Element \Template
17
22
{
@@ -22,9 +27,12 @@ class RequireCookie extends \Magento\Framework\View\Element\Template
22
27
*/
23
28
public function getScriptOptions ()
24
29
{
30
+ $ isRedirectCmsPage = ObjectManager::getInstance ()->get (ScopeConfigInterface::class)
31
+ ->getValue ('web/browser_capabilities/cookies ' );
25
32
$ params = [
26
33
'noCookieUrl ' => $ this ->escapeUrl ($ this ->getUrl ('cookie/index/noCookies/ ' )),
27
- 'triggers ' => $ this ->escapeHtml ($ this ->getTriggers ())
34
+ 'triggers ' => $ this ->escapeHtml ($ this ->getTriggers ()),
35
+ 'isRedirectCmsPage ' => (boolean )$ isRedirectCmsPage
28
36
];
29
37
return json_encode ($ params );
30
38
}
Original file line number Diff line number Diff line change 11
11
"Cookie Domain","Cookie Domain"
12
12
"Use HTTP Only","Use HTTP Only"
13
13
"Cookie Restriction Mode","Cookie Restriction Mode"
14
+ "Cookies are disabled in your browser.","Cookies are disabled in your browser."
15
+
Original file line number Diff line number Diff line change 8
8
*/
9
9
define ( [
10
10
'jquery' ,
11
- 'jquery-ui-modules/widget'
12
- ] , function ( $ ) {
11
+ 'Magento_Ui/js/modal/alert' ,
12
+ 'jquery-ui-modules/widget' ,
13
+ 'mage/mage' ,
14
+ 'mage/translate'
15
+ ] , function ( $ , alert ) {
13
16
'use strict' ;
14
17
15
18
$ . widget ( 'mage.requireCookie' , {
16
19
options : {
17
20
event : 'click' ,
18
21
noCookieUrl : 'enable-cookies' ,
19
- triggers : [ '.action.login' , '.action.submit' ]
22
+ triggers : [ '.action.login' , '.action.submit' ] ,
23
+ isRedirectCmsPage : true
20
24
} ,
21
25
22
26
/**
@@ -49,8 +53,16 @@ define([
49
53
if ( navigator . cookieEnabled ) {
50
54
return ;
51
55
}
56
+
52
57
event . preventDefault ( ) ;
53
- window . location = this . options . noCookieUrl ;
58
+
59
+ if ( this . options . isRedirectCmsPage ) {
60
+ window . location = this . options . noCookieUrl ;
61
+ } else {
62
+ alert ( {
63
+ content : $ . mage . __ ( 'Cookies are disabled in your browser.' )
64
+ } ) ;
65
+ }
54
66
}
55
67
} ) ;
56
68
You can’t perform that action at this time.
0 commit comments