Skip to content

Commit b1a91cb

Browse files
author
b__b
committed
refactoring
1 parent 0503db9 commit b1a91cb

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

Plugin/Frontend/Magento/Theme/Controller/Result/JsFooterPlugin.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@
1414
use Magento\Framework\App\ResponseInterface;
1515
use Magento\Framework\View\Result\Layout;
1616
use Magento\Store\Model\ScopeInterface;
17+
use Magefan\RocketJavaScript\Model\Config;
1718

1819
class JsFooterPlugin
1920
{
20-
21-
private const XML_PATH_RJ_DEFERRED_ENABLED = 'mfrocketjavascript/deferred_javascript/enabled';
22-
2321
/**
2422
* @var ScopeConfigInterface
2523
*/
@@ -48,12 +46,12 @@ public function aroundAfterRenderResult(
4846
Layout $result,
4947
ResponseInterface $httpResponse
5048
) {
51-
$jsRjOptimization = $this->scopeConfig->isSetFlag(self::XML_PATH_RJ_DEFERRED_ENABLED, ScopeInterface::SCOPE_STORE)
52-
&& $this->scopeConfig->isSetFlag('mfrocketjavascript/general/enabled', ScopeInterface::SCOPE_STORE);
53-
if ($jsRjOptimization) {
54-
return $result;
55-
}
49+
$jsRjOptimization =
50+
$this->scopeConfig->isSetFlag(Config::XML_PATH_DEFERRED_ENABLED, ScopeInterface::SCOPE_STORE) &&
51+
$this->scopeConfig->isSetFlag(Config::XML_PATH_EXTENSION_ENABLED, ScopeInterface::SCOPE_STORE);
5652

57-
return $proceed($argumentSubject, $result, $httpResponse);
53+
return $jsRjOptimization
54+
? $result
55+
: $proceed($argumentSubject, $result, $httpResponse);
5856
}
5957
}

0 commit comments

Comments
 (0)