Description of the need

If things go as planned, we may be able to introduce the concept of configuration recipes with the next release of Backdrop CMS (1.20, scheduled for release on September 15, 2021).

Early testing shows the ability to add nodes, fields, and views pretty easily. However, there are problems with adding module configuration via a config recipe (and I think that probably should have been expected).

For testing purposes, I created a FAQ config recipe module. It does the following things:

1) Creates a FAQ content type with one custom field 2) Creates a view of FAQ nodes 3) It uses the Views Bootstrap module to display the FAQ questions in an accordion.

I created this Config Recipes partially to test our ability to create module "Dependencies". It worked as expected, except that the configuration file that I included in the recipe does not make the required changes to the modules configuration.

I assume (based upon my current knowledge) that configuration management (which we are tapping into for config recipes) does not update config files. It only adds new ones or deletes those that are no longer needed.

In fact for my recipe, it works better to NOT make Views Bootstrap a dependency. If I make Views Bootstrap a dependency of my recipe, Views Bootstrap creates its own config file and the recipe seems to be unable to overwrite it. But, if I remove the dependency and enable my recipe first, it will upload the config for Views Bootstrap before enabling the module, then when the module is enabled it will use the config file from the recipe rather than writing a new one. However, it does mean that for a time we have a config file for a module that has not been enabled (will this be a problem later)?

Proposed solution

As I typed this out, it occurred to me that we are unlikely to add configuration to a module that is already enabled and has its own configuration file already - too many opportunities to loose existing configuration.

However, if a required module has not been installed before a config recipe - it MIGHT be possible to use the config file provided by the recipe BEFORE enabling the module? This is just a thought, but I'm seeing where that might be difficult. I think it's safe, because if the module is being newly enabled, then it probably doesn't have existing config. But, then again - if a module is disabled, we don't delete the config until the file is uninstalled, so maybe it's not safe.

Alternatives that have been considered

(06/13/2024) - I'm doing a lot of work with Recipes lately and what I've been doing to work around this is using PHP in the .install file for a recipe to modify the config for alread enabled modules.

Additional information

See this PR that opens up the possibility of config recipes: https://github.com/backdrop/backdrop-issues/issues/3224

See this issue about the idea of recipes in general: https://github.com/backdrop/backdrop-issues/issues/3763

GitHub Issue #: 
5173