I am looking for a way that I can generate a default set of theme-settings during install. Based upon the documentation a copy of files are created in the files/adaptivetheme folder, however these files are not generated until the theme-settings have been saved.

Is it possible to to alter the default theme-settings in our subtheme and have these applied after install without having to save the configuration from the theme settings page manually?

Any help or suggestions would be appreciated.

Thanks,
Adam

Comments

Jeff Burnz’s picture

In all honesty, I don't know. I have looked at this many times and always come to the conclusion that it may not be possible.

Themes don't really get installed, not how you might think. All the actual data for a theme (the theme settings, function overrides, template information etc), is not cached or saved to the database until after you view page in your site using that theme or the theme settings are saved, depending on the data and where its saved (two different things).

I could do into a long winded explanation here, but suffice to say - when you "enable a theme" the only things that actually go into the database are some systems table entries and menu system stuff. No actual theme data is saved (such as the theme registry or variable table entries - these are the ones we care about).

The idea I have had is that I would force the submit function to fire on theme_enable, but I don't really know how to do that, and if an error occurred how to handle that, or if its even possible. the only thing I can see that might be able to do this is hook_themes_enabled() and that would need to be run in a module, that was installed already, and that is the idea I have had - to build a module that installs and actually properly uninstalls themes (there is also no real uninstall for themes in core, which is terrible).

Take a look at this page in the API: http://api.drupal.org/api/drupal/modules!locale!locale.module/function/l...

Note the TODO: The theme system is missing an installation hook.

As you can see, this gets complicated, really fast. No theme I have looked at does this, unless I overlooked one that does, which would be awesome and I would love to know how it could be done also.

Jeff Burnz’s picture

Status: Active » Fixed

I believe the original questions have been answered.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.