How to set theme_paths from Package Controller
PermalinkWith the Config::set() method i can do stuff like Config::set('concrete.debug.detail', 'debug'); but it seems it is not possible to do something like this:
Config::set('app.theme_paths.login', 'theme_name');
Am I doing something wrong here, or is it just not possible?

Can you describe what you want to do..?
To set theme path I think you need setup View object.
Just try to give you hint (concrete5.7).
Try to take a look View Object in \concrete\src\View\View.php
check method loadViewThemeObject(), and setViewTheme()
good luck
I am using 5.7.3.1.
Like I said in the original post, I want to set the theme_paths array in /config/app.php automatically from my theme's package controller. Using Config::set() I can change the arrays in /config/concrete.php but not in /config/app.php.
As i see it the Config::set() method saves the config overrides in the ConfigStore Database Table. But when I actually look there, the changed settings are not reflected there. But they apply anyway. They also can't be found in application/config/concrete.php or concrete/config/concrete.php.
I took a look at the class you suggested and I think this class makes use of the settings defined by the theme_paths array, but I saw no way to set it there.
you have to use Config::set('app.theme_paths./login', 'your_theme_handle');
Here's the relevant part of my package controller in case you spot an error there:
public function on_start() {
// Dev Settings
Cfg::set('concrete.accessibility.display_help_system', false);
Cfg::set('concrete.debug.detail', 'debug');
Cfg::set('concrete.cache.enabled', false);
Cfg::set('concrete.cache.overrides', false);
Cfg::set('concrete.cache.blocks', false);
Cfg::set('concrete.cache.assets', false);
Cfg::set('concrete.cache.theme_css', false);
// Custom Single Pages
Cfg::set('app.theme_paths./login', 'eset_theme');
Cfg::set('app.theme_paths./maintenance_mode', 'eset_theme');
}
Edit: login.php and maintenance_mode.php are in the root of my theme folder
Edit 2: if I inspect my theme the template shows up with the following message: This file will automatically be used by the Login page.
It does print out my theme name, but the login page is still the default concrete5 single page. I have no idea why.
I changed the statement to:
print_r(Cfg::get('app.theme_paths./register', 'eset_theme'));
and it prints out "concrete" which is correct, since I didn't change the register.php page.
Server restart, clearing cache etc. does not work. Maybe it gets overwritten elsewhere...
You can debug it in another way:
Create register page and rewrite it, to check if problem is just in login page or in all system pages
\Config::save('app.theme_paths./login', ['theme_name']);
Idiotically though, 'clear' uses 'set' to clear a value so you have to delete the app file manually to revert as you can't unwrite the file on uninstall in your package. Bit stupid, that.
Going to ask why set doesn't do what you'd think as putting it in the on_start seems the totally obvious thing to do for changing login pages, etc. Why the good old single page override doesn't just work like it used to is another mystery for another day though.
The best solution I have found since posting this question two and a half years ago is this:
\Route::setThemeByRoute('/login', 'my_theme_handle');