scopeConfig = $scopeConfig; $this->storeManager = $storeManager; $this->devHelper = $devHelper; $this->debugHintsFactory = $debugHintsFactory; $this->debugHintsPath = $debugHintsPath; $this->http = $http ?: \Magento\Framework\App\ObjectManager::getInstance()->get( \Magento\Framework\App\Request\Http::class ); $this->debugHintsWithParam = $debugHintsWithParam; $this->debugHintsParameter = $debugHintsParameter; } /** * Wrap template engine instance with the debugging hints decorator, depending of the store configuration * * @param TemplateEngineFactory $subject * @param TemplateEngineInterface $invocationResult * * @return TemplateEngineInterface * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function afterCreate( TemplateEngineFactory $subject, TemplateEngineInterface $invocationResult ) { $storeCode = $this->storeManager->getStore()->getCode(); if ($this->scopeConfig->getValue($this->debugHintsPath, ScopeInterface::SCOPE_STORE, $storeCode) && $this->devHelper->isDevAllowed()) { $debugHintsWithParam = $this->scopeConfig->getValue( $this->debugHintsWithParam, ScopeInterface::SCOPE_STORE, $storeCode ); $debugHintsParameter = $this->scopeConfig->getValue( $this->debugHintsParameter, ScopeInterface::SCOPE_STORE, $storeCode ); $debugHintsParameterInUrl = $this->http->getParam('templatehints'); $showHints = false; if (!$debugHintsWithParam) { $showHints = true; } if ($debugHintsWithParam && $debugHintsParameter == $debugHintsParameterInUrl) { $showHints = true; } if ($showHints) { $showBlockHints = $this->scopeConfig->getValue( self::XML_PATH_DEBUG_TEMPLATE_HINTS_BLOCKS, ScopeInterface::SCOPE_STORE, $storeCode ); return $this->debugHintsFactory->create([ 'subject' => $invocationResult, 'showBlockHints' => $showBlockHints, ]); } } return $invocationResult; } }