Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. RecipeRunner.php

function RecipeRunner::toBatchOperationsRecipe

Helper method to convert a recipe to batch operations.

Parameters

\Drupal\Core\Recipe\Recipe $recipe: The recipe to convert to batch operations.

string[] $recipes: The paths of the recipes that have already been converted 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::toBatchOperationsRecipe()
RecipeRunner::toBatchOperations in core/lib/Drupal/Core/Recipe/RecipeRunner.php
Converts a recipe into a series of batch operations.

File

core/lib/Drupal/Core/Recipe/RecipeRunner.php, line 192

Class

RecipeRunner
Applies a recipe.

Namespace

Drupal\Core\Recipe

Code

protected static function toBatchOperationsRecipe(Recipe $recipe, array $recipes, array &$modules, array &$themes) : array {
    if (in_array($recipe->path, $recipes, TRUE)) {
        return [];
    }
    $steps = [];
    $recipes[] = $recipe->path;
    foreach ($recipe->recipes->recipes as $sub_recipe) {
        $steps = array_merge($steps, static::toBatchOperationsRecipe($sub_recipe, $recipes, $modules, $themes));
    }
    $steps = array_merge($steps, static::toBatchOperationsInstall($recipe, $modules, $themes));
    if ($recipe->config
        ->hasTasks()) {
        $steps[] = [
            [
                RecipeRunner::class,
                'installConfig',
            ],
            [
                $recipe,
            ],
        ];
    }
    if (!empty($recipe->content->data)) {
        $steps[] = [
            [
                RecipeRunner::class,
                'installContent',
            ],
            [
                $recipe,
            ],
        ];
    }
    $steps[] = [
        [
            RecipeRunner::class,
            'triggerEvent',
        ],
        [
            $recipe,
        ],
    ];
    return $steps;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal