This issue has come up in several places before, but most recently in https://github.com/backdrop/backdrop-issues/issues/4814 when @BWPanda noticed the strange processes required for properly handling theme settings, or more specifically, how to set their default values.
I would like to propose that themes get a themename.install
file just like modules do, and that we place install, uninstall, and update hooks there (for themes that have settings).
We could also allow hook_config_info()
to be defined in template.php
, and if it were present, we could handle the automatic installation of a provided config file when a theme was installed, and the automatic removal of that config file when the theme was uninstalled (the same way we do for modules).
Now, I'm not sure that the enabled/disabled/installed/uninstalled state system is the ideal approach for add-ons for Backdrop, but until we land on another method I think it would make sense to treat themes the same way we do modules. It would be consistent, and once someone learned it for one system they wouldn't need to learn anything different for the other.
I'm not sure this is possible to do in a backwards-compatible way, and if not, this proposal should be for backdrop 2.x :)
PS: FTR, most of the relevant work in Drupal was done as part of the meta-issue here: https://www.drupal.org/project/drupal/issues/1067408. Then there was this follow-up issue: https://www.drupal.org/project/drupal/issues/2652542, but it was closed as "won't fix", and there's been no further activity since May 2018. [edit] In July 2021, the following comment was added to that issue:
I'm here as I was surprised to find that while themes can define default configuration, they cannot define update hooks to modify that configuration or install new configuration if needed. For example, I have a Drupal 9 platform with themes that provide default config entities for the Layout Builder Styles and CKEditor Standlone Styles modules. If I want to make changes or add new config entities for sites that already exist and use those themes, it seems my only hope is to create a module, make that module a dependency of the theme, and put the config and update hooks in there?
Recent comments
Tried and successfully applied DrAlbany's method with the form https://www.drupal.org/sandbox/grobot/2105379stickman hook. I also encountered the same situation. Thanks DrAlbany
Ubercart - Auto increment SKU
Since before migration you need to prepare the Drupal site - disabling and removing all modules, disabling themes, as part of the preparation you can clear the cache and logs, delete the search...
Trimming the size of my database for D2B_migrate not to error out (Request Entity Too Large / 504 Gateway Time-out)
QuickTabs is now available!!! But does not work as expected, already reported (https://github.com/backdrop-contrib/quicktabs/issues/14). Maybe an alternative solution using Views...
Quick Tabs (or method to simulate)