function RecipeRunner::toBatchOperationsInstall
Converts a recipe's install tasks to batch operations.
Parameters
\Drupal\Core\Recipe\Recipe $recipe: The recipe to convert install tasks to batch operations.
string[] $modules: The modules that will already be installed due to previous recipes in the batch.
string[] $themes: The themes that will already be installed due to previous recipes in the batch.
Return value
array<int, array{0: callable, 1: array{mixed}}> The array of batch operations. Each value is an array with two values. The first value is a callable and the second value are the arguments to pass to the callable.
1 call to RecipeRunner::toBatchOperationsInstall()
- RecipeRunner::toBatchOperationsRecipe in core/
lib/ Drupal/ Core/ Recipe/ RecipeRunner.php  - Helper method to convert a recipe to batch operations.
 
File
- 
              core/
lib/ Drupal/ Core/ Recipe/ RecipeRunner.php, line 212  
Class
- RecipeRunner
 - Applies a recipe.
 
Namespace
Drupal\Core\RecipeCode
protected static function toBatchOperationsInstall(Recipe $recipe, array &$modules, array &$themes) : array {
  foreach ($recipe->install->modules as $name) {
    if (in_array($name, $modules, TRUE)) {
      continue;
    }
    $modules[] = $name;
    $steps[] = [
      [
        RecipeRunner::class,
        'installModule',
      ],
      [
        $name,
        $recipe,
      ],
    ];
  }
  foreach ($recipe->install->themes as $name) {
    if (in_array($name, $themes, TRUE)) {
      continue;
    }
    $themes[] = $name;
    $steps[] = [
      [
        RecipeRunner::class,
        'installTheme',
      ],
      [
        $name,
        $recipe,
      ],
    ];
  }
  return $steps ?? [];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.