function RecipeRunner::replaceInputValues

Parameters

mixed $data: The data that will have placeholders replaced.

array<string, mixed> $replace: An array whose keys are the placeholders to be replaced, and whose values are the replacements.

Return value

mixed The passed data, with placeholders replaced.

1 call to RecipeRunner::replaceInputValues()
RecipeRunner::processConfiguration in core/lib/Drupal/Core/Recipe/RecipeRunner.php
Creates configuration and applies configuration actions.

File

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

Class

RecipeRunner
Applies a recipe.

Namespace

Drupal\Core\Recipe

Code

private static function replaceInputValues(mixed $data, array $replace) : mixed {
    if (is_string($data)) {
        $data = str_replace(array_keys($replace), $replace, $data);
    }
    elseif (is_array($data)) {
        foreach ($data as $key => $value) {
            $data[$key] = static::replaceInputValues($value, $replace);
        }
    }
    return $data;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.