I am getting trouble with Magento 2.0. I have to use current active theme name which I got in magento 1.x versions like:
"Mage::getSingleton('core/design_package')->getPackageName()"
But I didn't get any alternate for Magento 2.0. Please suggest me what model or function should I use.
I found the solution: Follwing class will need to have dependency:
\Magento\Framework\App\Config\ScopeConfigInterface
\Magento\Store\Model\StoreManagerInterface
\Magento\Framework\View\Design\Theme\ThemeProviderInterface
Use this method to get data for current theme:
public function getTheme()
{
$themeId = $this->_scopeConfig->getValue(
\Magento\Framework\View\DesignInterface::XML_PATH_THEME_ID,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
$this->_storeManager->getStore()->getId()
);
/** @var $theme \Magento\Framework\View\Design\ThemeInterface */
$theme = $this->_themeProvider->getThemeById($themeId);
return $theme->getData();
}