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
Thanks Alejandro. That was the clues I needed.
Ubercart - Programmatically add product to cart and straight to Checkout
Have you tried uc_cart_add_item()? You need to provide the nid of the product. Then you can use backdrop_goto('cart/checkout'); to send the user to the checkout screen. uc_cart_add_item...
Ubercart - Programmatically add product to cart and straight to Checkout
No problem, let's see how it evolves. I'd be happy to provide a suggested version if i could. I will keep that in mind and try learn this hook chain hopefully very soon. I will...
File hashing uploads made through TinyMCE