@@ -17,19 +17,19 @@ class ResultPlugin
1717{
1818 const EXCLUDE_FLAG_PATTERN = 'data-rocketjavascript="false" ' ;
1919
20+ /**
21+ * Request
22+ * @var \Magento\Framework\App\RequestInterface
23+ */
24+ protected $ request ;
25+
2026 /**
2127 * Core store config
2228 *
2329 * @var \Magento\Framework\App\Config\ScopeConfigInterface
2430 */
2531 protected $ scopeConfig ;
2632
27- /**
28- * Request
29- * @var \Magento\Framework\App\RequestInterface
30- */
31- protected $ request ;
32-
3333 /**
3434 * @param \Magento\Framework\App\RequestInterface $request
3535 * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
@@ -98,9 +98,30 @@ public function aroundRenderResult(
9898
9999 private function isEnabled ()
100100 {
101- return $ this ->scopeConfig ->getValue (
101+ $ enabled = $ this ->scopeConfig ->getValue (
102102 'mfrocketjavascript/general/enabled ' ,
103103 \Magento \Store \Model \ScopeInterface::SCOPE_STORE
104104 );
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 ;
105126 }
106127}
0 commit comments