I am writing setup script for the theme configuration but stuck at how to set default cms home page for this theme.
Here is the script that is setting my theme as default theme. Setup script is working fine. app/code/RLTSquare/CmsInstall/Setup/InstallData.php
<?php namespace RLTSquare\CmsInstall\Setup; use Magento\Framework\Setup\InstallDataInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\ModuleDataSetupInterface; use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Store\Model\Store; class InstallData implements InstallDataInterface { const THEME_NAME = 'Rlts/brokertheme'; /** * @var \Magento\Theme\Model\Config */ private $config; /** * @var \Magento\Theme\Model\ResourceModel\Theme\CollectionFactory */ private $collectionFactory; public function __construct( \Magento\Theme\Model\ResourceModel\Theme\CollectionFactory $collectionFactory, \Magento\Theme\Model\Config $config, \Magento\Framework\App\Config\ConfigResource\ConfigInterface $resourceConfig, ) { $this->resourceConfig = $resourceConfig; $this->collectionFactory = $collectionFactory; $this->config = $config; } /** * Installs data for a module * * @param ModuleDataSetupInterface $setup * @param ModuleContextInterface $context * @return void */ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) { $setup->startSetup(); $themeID = $this->getThemeId(); $this->resourceConfig->saveConfig('design/theme/theme_id',$themeID,'default','0'); $setup->endSetup(); } protected function getThemeId() { $themes = $this->collectionFactory->create()->loadRegisteredThemes(); /** * @var \Magento\Theme\Model\Theme $theme */ $themeId=NULL; foreach ($themes as $theme) { if ($theme->getCode() == self::THEME_NAME) { $themeId = $theme->getid(); break; } } return $themeId; } }