Problem/Motivation

When using the Recipe Installer Kit with a profile that defines default recipes but no optional recipes, the default recipes are never applied during installation.

This happens because:

  1. The RecipesForm is configured in the profile's forms: list
  2. RecipesForm::toInstallTask() skips the form when no optional recipes are defined (lines 17-20)
  3. When the form is skipped, submitForm() is never called
  4. Therefore, $install_state['parameters']['recipes'] is never populated with the default recipes
  5. In Hooks::applyRecipes(), only required recipes and parameters['recipes'] are used - the default recipes are ignored

Steps to reproduce

  1. Create a profile with the following info.yml configuration:
    forms:
        - '\Drupal\RecipeKit\Installer\Form\RecipesForm'
      recipes:
        required: []
        default:
          - drupal/my_starter_recipe
      
  2. Run the Drupal installer
  3. Notice that my_starter_recipe is never applied

Proposed resolution

Modify Hooks::applyRecipes() to fall back to default recipes when parameters['recipes'] is not set.

Change from:

$recipes_to_apply = array_merge(
    $install_state['profile_info']['recipes']['required'] ?? [],
    $install_state['parameters']['recipes'] ?? [],
  );
  

To:

$recipes_to_apply = array_merge(
    $install_state['profile_info']['recipes']['required'] ?? [],
    $install_state['parameters']['recipes'] ?? $install_state['profile_info']['recipes']['default'] ?? [],
  );
  

This ensures that when no form populates parameters['recipes'] (because the form was skipped), the installation falls back to the default recipes defined in the profile's info.yml.

Remaining tasks

User interface changes

API changes

  • N/A

Data model changes

  • N/A
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

rajab natshah created an issue. See original summary.

rajab natshah’s picture

Assigned: rajab natshah » Unassigned
Status: Active » Needs review

phenaproxima’s picture

Status: Needs review » Fixed

That looks great. Thanks! Merged into 1.x.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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