Problem/Motivation

Currently install profiles like standard provide optional configuration. When modelling these as recipes, we face the question of how to support such conditionality. For example, various media-related configuration entities will be installed only if/when the media module is installed. To replicate this functionality in a standard recipe, we'll need the ability to install with our without including media and the recipes that require it.

Proposed resolution

One possible approach would be an install mode where all recipes listed under "suggest" are installed. In this approach, a standard recipe would suggest optional recipes. At recipe run time, an optional argument determines whether the suggested packages are also installed. This may require user feedback; see #3303126: Make it possible for recipes to prompt for input values.

Remaining tasks

User interface changes

API changes

Data model changes

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

nedjo created an issue. See original summary.

nedjo’s picture

Title: Determine pattern for optional config and modules » Determine reipe pattern for optional config and modules
nedjo’s picture

Title: Determine reipe pattern for optional config and modules » Determine recipe pattern for optional config and modules
narendrar’s picture

I am also facing similar problem where I need to convert a contributed module (https://www.drupal.org/project/acquia_cms_event) functionality as recipe. This module creates an Event content type and related configuration are stored in config/optional folder.
What should be the approach to convert it to a Recipe?

thejimbirch’s picture

We are slowly identifying this as a top issue.

thejimbirch’s picture

Version: 10.0.x-dev » 11.x-dev
jurgenhaas’s picture

I may be wrong with this, but in the context of an installation profile, the config/optional doesn't really make much sense. The installation profile is deterministic as it fully controls what's installed and what not. In other words, the installation profile knows exactly what's available and therefore doesn't actually need the optional configuration. That's different for modules, as they can't tell the context in which they get installed. So, if modules come with optional configuration, that makes sense to me.

A recipe, on the other hand, is declarative and describes exactly what it requires and applies that in total to the Drupal site.

Thinking outside the box, do we really require optional configuration with properly structure recipes that depend upon each other?

b_sharpe’s picture

I would agree with #7. A recipe doesn't have optional config, it's either there or it's not. Module config is not going away nor should required/optional config be converted to a recipe for it (IMO) as the module is saying "Do this always, and if this other thing exist during install, also apply that". A recipe on the other hand could install this same module as well as whatever it requires to get it's optional config to go along with (among other things).

thejimbirch’s picture

Version: 11.x-dev » 1.0.x-dev
Component: Code » Documentation

I agree with #7 and #8. Recipes are declarative and should not leave anything to be optional.

The recipe author, to #4's question should decide whether they want the functionality or not, and create their recipes as needed.

I would like to close this issue as Work's as designed, but I feel like we should document how to deal with optional config in modules and installation profiles in the recipe author guide in the docs.

thejimbirch’s picture

Status: Active » Closed (works as designed)
johnwebdev’s picture

Have this been documented?

johnwebdev’s picture

Status: Closed (works as designed) » Active

thejimbirch’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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