Yuck.
The following code is in system_install():
// Enable the default theme.
variable_set('theme_default', 'bartik');
db_update('system')
->fields(array('status' => 1))
->condition('type', 'theme')
->condition('name', 'bartik')
->execute();
That's not right. That's going to force the Bartik theme to be enabled for every single site out there, even if their install profile uses a different theme. I ran into this while reviewing #632100: Use Stark as default theme for Minimal install profile.
This is kind of a tricky problem to solve, however. I don't think we can variable_set('default_theme', 'something_else');
before system_install() runs, because that's what's going to create the variable table in the first place. Hmmm.
Comments
Comment #1
Damien Tournoud CreditAttribution: Damien Tournoud commentedHm? And the bug is?
The installation profile just need to un-enable it.
Comment #2
webchickThe bug, at least to me, is hard-coded assumptions in system module, of all places. While it's true that every single install profile could *undo* what system_install() does, that seems rather sub-optimal. :P
However, given that the D6 version of system_installI() does exactly the same thing:
I guess you're right that this isn't a bug so much as a feature request for us not to be so janky.
Comment #3
webchickComment #4
webchickA possible idea for implementation: a new
theme = xxx
in the install profile's .info file which system module would check and variable_set() it to that. If left unspecified, it would default to whatever variable_get('default_theme')'s default is (currently, bartik).Comment #5
mlncn CreditAttribution: mlncn commentedI think theme_enable() / theme_disable() work here (see #719814: Add tests for default templates (like node.tpl.php)), but it still seems installation profiles should be able to just have a theme = xxx.
Comment #6
tstoecklerThe approach I'm advocating in #1181776: Change theme_default variable to Stark would require something like this, so I would like to work on it, but I think we should agree on a name of the property we're adding first.
@webchick proposed:
theme = bartik
That is definitely the easiest, but I wonder if it is weird for profiles that enable multiple themes. They have to set one as default, so the property still makes sense for them, but it would be named
default theme = bartik
more ideally for them. So I would lean more towardsdefault theme
but I'm not quite sure.Thoughts?
Comment #7
Dustin@PI CreditAttribution: Dustin@PI commentedMy suggestion:
If
admin theme
is not set, it is set to the value ofdefault theme
. Ifdefault theme
is not set it should be set tothemes[0]
.Comment #8
sunThe proposal in #7 makes sense to me.
That said, I actually think that those properties are plain configuration, so I'm playing with the idea of doing:
#1608842: Replace list of bootstrap modules, enabled modules, enabled themes, and default theme with config
However, I'm not 100% sure whether we'll be able to pull that off for D8 (I'd surely love to), so I don't think it would be a good idea to block/postpone this issue on that effort.
Closely related: Someone pointed to a Commerce Kickstart hack on Twitter:
http://drupalcode.org/project/commerce_kickstart.git/commitdiff/df21a9f9...
Essentially, an installation profile needs to be able to choose the (maintenance) theme to be used within the installer itself.
Comment #9
DuaelFrThis issue have been fixed by the CMI.
There is no theme definition in
system_install()
anymore. Everything is now in asystem.theme.yml
file that can be overriden by your profile.