@@ -17,19 +17,19 @@ class ResultPlugin
17
17
{
18
18
const EXCLUDE_FLAG_PATTERN = 'data-rocketjavascript="false" ' ;
19
19
20
+ /**
21
+ * Request
22
+ * @var \Magento\Framework\App\RequestInterface
23
+ */
24
+ protected $ request ;
25
+
20
26
/**
21
27
* Core store config
22
28
*
23
29
* @var \Magento\Framework\App\Config\ScopeConfigInterface
24
30
*/
25
31
protected $ scopeConfig ;
26
32
27
- /**
28
- * Request
29
- * @var \Magento\Framework\App\RequestInterface
30
- */
31
- protected $ request ;
32
-
33
33
/**
34
34
* @param \Magento\Framework\App\RequestInterface $request
35
35
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
@@ -98,9 +98,30 @@ public function aroundRenderResult(
98
98
99
99
private function isEnabled ()
100
100
{
101
- return $ this ->scopeConfig ->getValue (
101
+ $ enabled = $ this ->scopeConfig ->getValue (
102
102
'mfrocketjavascript/general/enabled ' ,
103
103
\Magento \Store \Model \ScopeInterface::SCOPE_STORE
104
104
);
105
+
106
+ /* check if Plumrocket AMP enabled */
107
+ if ($ enabled ) {
108
+ $ isAmpRequest = $ this ->scopeConfig ->getValue (
109
+ 'pramp/general/enabled ' ,
110
+ \Magento \Store \Model \ScopeInterface::SCOPE_STORE
111
+ );
112
+
113
+ if ($ isAmpRequest ) {
114
+ /* We know that using objectManager is not a not a good practice,
115
+ but if Plumrocket_AMP is not installed on your magento instance
116
+ you'll get error during di:compile */
117
+ $ objectManager = \Magento \Framework \App \ObjectManager::getInstance ();
118
+ $ isAmpRequest = $ objectManager ->get ('\Plumrocket\Amp\Helper\Data ' )
119
+ ->isAmpRequest ();
120
+ }
121
+
122
+ $ enabled = !$ isAmpRequest ;
123
+ }
124
+
125
+ return $ enabled ;
105
126
}
106
127
}
0 commit comments