浏览文章

文章信息

Magento2 读取当前主题|get current theme 13862

代码:

            $ob = ObjectManager::getInstance();
            $store = $this->getStore();
            $scopeConfig = $ob->get(ScopeConfigInterface::class);
            $themeId = $scopeConfig->getValue(
                \Magento\Framework\View\DesignInterface::XML_PATH_THEME_ID,
                \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
                $store->getId()
            );
            $themeProvider = $ob->get(ThemeProvider::class);
            /** @var $theme \Magento\Framework\View\Design\ThemeInterface */
            $theme = $themeProvider->getThemeById($themeId);


原创