Problem/Motivation

We support install profiles, to customize the installation experience to some degree.

And we support installing Drupal from a recipe, bypassing the profile entirely.

But what we don't yet support is the in-between zone: you want to customize the install experience, but you also want to apply a recipe (or set of recipes) at install time. This grey zone is where Drupal CMS exists, and it needs to do some hacky workarounds to make that possible.

Proposed resolution

Allow a profile's info file to specify a list of recipes that should be applied once modules are installed. These recipes would be applied in the order they are listed, by appending their batch operations to the ones from install_profile_modules.

User interface changes

None.

Introduced terminology

None.

API changes

A new recipes key would be supported in profile info files.

Release notes snippet

TBD

Issue fork drupal-3605549

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

phenaproxima created an issue. See original summary.

phenaproxima’s picture

Status: Active » Needs review

Added this new ability, and a basic test to prove it works with core recipes.

The main missing thing here is path resolution. Core recipe paths are used as-is, but if we add this ability, then we need to resolve recipe directory paths relative to...somewhere. How should we handle that? A few possibilities:

  • We could always resolve the paths relative to the web root, so in a drupal/recommended-project layout, the paths would be listed as ../recipes/foo. This is the simplest, but it means profiles using this superpower would be tightly coupled to the project layout.
  • We could introspect the Composer configuration for the project to determine where drupal-recipe packages will be installed, and resolve relative to that. This is what Drupal CMS does, and is probably the most robust choice.
  • We could do some kind of lightweight "recipe discovery" where we scan certain directories for recipes, at install time only.
  • We could add an $install_state['recipes_directory'] variable, defaulting to ../recipes. This could be overridden programmatically by calling install_drupal() directly, or by a custom profile which does a similar thing. This is probably the most lightweight "configurable" option, since $install_state is already a hodgepodge of various state flags used only by the installer.
  • We could also do nothing to address this, and leave the patch as-is. This approach would force custom profiles which want to use this superpower to fully resolve the recipe paths on their own and inject them into $install_state['profile_info'].

Or maybe something else?

gábor hojtsy’s picture

This also needs to take into account translation at one point. If not here then modified later to do it :) That the recipe should get its translation file downloaded prior to being applied. The data from such .po file is not currently used but will be after #3472317: Config language adaptation and translation does not happen at all when config is applied from a recipe.

gábor hojtsy’s picture

Status: Needs review » Reviewed & tested by the community

Anyway recipes do not support that yet, so we can get this in like so, I think its quite simple and elegant and well tested :)

gábor hojtsy’s picture