/** * Retrieve config section * * @param string $scopeType * @param string|\Magento\Framework\Object|null $scopeCode * @return \Magento\Framework\App\Config\DataInterface */ public function getScope($scopeType, $scopeCode = null) { $scopeCode = $this->_getScopeCode($scopeType, $scopeCode); $code = $scopeType . '|' . $scopeCode; if (!isset($this->_scopes[$code])) { $cacheKey = $this->_cacheId . '|' . $code; $data = $this->_cache->load($cacheKey); if ($data) { $data = unserialize($data); } else { $reader = $this->_readerPool->getReader($scopeType); if ($scopeType === \Magento\Framework\App\ScopeInterface::SCOPE_DEFAULT) { $data = $reader->read(); } else { $data = $reader->read($scopeCode); } $this->_cache->save(serialize($data), $cacheKey, [self::CACHE_TAG]); } $this->_scopes[$code] = $this->_dataFactory->create(['data' => $data]); } return $this->_scopes[$code]; }
/** * @param array $context * @return string The rendered template */ public function render(array $context = array()) : string { $data = $this->dataFactory->create($context); return $this->_render($data); }