File tree Expand file tree Collapse file tree 5 files changed +91
-0
lines changed
Expand file tree Collapse file tree 5 files changed +91
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php declare (strict_types=1 );
2+
3+ namespace Yireo \MspDevToolsFixes \Plugin ;
4+
5+ use Magento \Framework \App \Request \Http ;
6+ use MSP \DevTools \Model \Config ;
7+
8+ class DisableWithAjax
9+ {
10+ /**
11+ * @var Http
12+ */
13+ private $ http ;
14+
15+ /**
16+ * DisableWithAjax constructor.
17+ * @param Http $http
18+ */
19+ public function __construct (Http $ http )
20+ {
21+ $ this ->http = $ http ;
22+ }
23+
24+ /**
25+ * @param Config $config
26+ * @param bool $return
27+ * @return bool
28+ */
29+ public function afterCanInjectCode (Config $ config , bool $ return )
30+ {
31+ if ($ return === true && $ this ->isAjax ()) {
32+ return false ;
33+ }
34+
35+ return $ return ;
36+ }
37+
38+ /**
39+ * @return bool
40+ */
41+ private function isAjax (): bool
42+ {
43+ $ contentType = $ this ->http ->getHeader ('Content-Type ' );
44+ if ($ contentType === 'application/json ' ) {
45+ return true ;
46+ }
47+
48+ return false ;
49+ }
50+ }
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " yireo/msp-dev-tools-fixes" ,
3+ "version" : " 1.0.0" ,
4+ "description" : " N/A" ,
5+ "type" : " magento2-module" ,
6+ "require" : {
7+ "magento/framework" : " *"
8+ },
9+ "license" : [
10+ " Proprietary"
11+ ],
12+ "autoload" : {
13+ "files" : [
14+ " registration.php"
15+ ],
16+ "psr-4" : {
17+ "Yireo\\ MspDevToolsFixes\\ " : " "
18+ }
19+ }
20+ }
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" ?>
2+ <config xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
3+ xsi : noNamespaceSchemaLocation =" urn:magento:framework:ObjectManager/etc/config.xsd" >
4+ <type name =" MSP\DevTools\Model\Config" >
5+ <plugin name =" Yireo_MspDevToolsFixes::disableWithAjax" type =" Yireo\MspDevToolsFixes\Plugin\DisableWithAjax" />
6+ </type >
7+ </config >
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" ?>
2+ <config xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
3+ xsi : noNamespaceSchemaLocation =" urn:magento:framework:Module/etc/module.xsd" >
4+ <module name =" Yireo_MspDevToolsFixes" >
5+ <sequence >
6+ <module name =" MSP_DevTools" />
7+ </sequence >
8+ </module >
9+ </config >
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ use Magento \Framework \Component \ComponentRegistrar ;
4+
5+ ComponentRegistrar::register (ComponentRegistrar::MODULE , 'Yireo_MspDevToolsFixes ' , __DIR__ );
You can’t perform that action at this time.
0 commit comments