Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static function ThemeDetail(){
- $objectManager = MagentoFrameworkAppObjectManager::getInstance()
- ->get('MagentoFrameworkAppResourceConnection');
- $connection= $objectManager->getConnection();
- $theme_table = $objectManager->getTableName('theme');
- $theme_data = $connection->fetchAll("SELECT * FROM ".$theme_table);
- if(!empty($theme_data)){
- foreach($theme_data as $theme_name => $value){
- $themeArray[] = array('name'=> $theme_data[$theme_name]['theme_title'], 'version'=>'2.0.5');
- }
- return $themeArray;
- } else {
- return FALSE;
- }
- }
- MagentoFrameworkAppConfigScopeConfigInterface
- MagentoStoreModelStoreManagerInterface
- MagentoFrameworkViewDesignThemeThemeProviderInterface
- public function getThemeData()
- {
- $themeId = $this->_scopeConfig->getValue(
- MagentoFrameworkViewDesignInterface::XML_PATH_THEME_ID,
- MagentoStoreModelScopeInterface::SCOPE_STORE,
- $this->_storeManager->getStore()->getId()
- );
- /** @var $theme MagentoFrameworkViewDesignThemeInterface */
- $theme = $this->_themeProvider->getThemeById($themeId);
- return $theme->getData();
- }
- Use directly objectmanager is not right way, use __construct() way to define your class inside block is better way to use coding standard.
- public static function ThemeDetail(){
- $connection = $objectManager = MagentoFrameworkAppObjectManager::getInstance()
- ->get('MagentoFrameworkAppResourceConnection')->getConnection('MagentoFrameworkAppResourceConnection::DEFAULT_CONNECTION');
- $version = $objectManager->get('MagentoFrameworkAppProductMetadataInterface');
- $theme_table = $connection->getTableName('theme');
- $theme_data = $connection->fetchAll("SELECT * FROM ".$theme_table);
- $themeArray = array();
- if(!empty($theme_data)){
- foreach($theme_data as $value){ echo $value['theme_title'];
- $themeArray[] = array('name'=> $value['theme_title'], 'version'=>$version->getVersion());
- }
- } else {
- return FALSE;
- }
- echo "<pre>";print_r($themeArray);exit;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement