I have a cookie variable mobile-application = "yes". I need to set a custom theme depends on this variable in magento2. I've already created a custom theme. How I can set it programmatically in runtime. In magento1 works this example:
<models>
<core>
<rewrite>
<design>Packagename_Modulename_Model_Design</design>
</rewrite>
</core>
</models>
Rewrite PHP code
public function loadChange($storeId, $date = null)
{
$result = $this->getResource()
->loadChange($storeId, $date);
if (!empty($result)) {
if (!empty($result['design'])) {
$tmp = explode('/', $result['design']);
$result['package'] = $tmp[0];
$result['theme'] = $tmp[1];
}
$this->setData($result);
}
// your custom code goes here
// custom condition
if(true) {
$result['package'] = 'default';
$result['theme'] = 'modern';
$this->setData($result);
}
return $this;
}
Has anybody experience with this point for magetno2?