I'm creating a local plug-in in which site admins can configure relationships between domain name and theme being served. I created a multi-tenant Moodle site before in which I was using a big switch statement on $_SERVER['SERVER_NAME'] to change the $CFG->theme property. Now I'm making this more dynamic but I'm encountering a problem.
I was thinking of adding a line to config.php that calls a method in my autoloaded class. The method will then return the theme name into $CFG->theme. When I do this, or anything for that matter, theme loading breaks horribly. So using config.php seems out of the question.
I think I need to do something with initialise_theme_and_output() but I'm unsure how I can trick that function to load a different theme based on the domain name you're visiting from.
- Unable to call a function for information fetching after the require_once to setuplib
- Unknown to me how and where I need to perform magic in my plug-in to influence the theme.
What can I influence to set the current active theme to be something stored in a table from my plug-in?