function RecipeRunner::processConfiguration
Same name in other branches
- 10 core/lib/Drupal/Core/Recipe/RecipeRunner.php \Drupal\Core\Recipe\RecipeRunner::processConfiguration()
Creates configuration and applies configuration actions.
Parameters
\Drupal\Core\Recipe\Recipe $recipe: The recipe being applied.
2 calls to RecipeRunner::processConfiguration()
- RecipeRunner::installConfig in core/
lib/ Drupal/ Core/ Recipe/ RecipeRunner.php - Installs a config for a recipe.
- RecipeRunner::processRecipe in core/
lib/ Drupal/ Core/ Recipe/ RecipeRunner.php
File
-
core/
lib/ Drupal/ Core/ Recipe/ RecipeRunner.php, line 95
Class
- RecipeRunner
- Applies a recipe.
Namespace
Drupal\Core\RecipeCode
protected static function processConfiguration(Recipe $recipe) : void {
$config_installer = new RecipeConfigInstaller(\Drupal::service('config.factory'), \Drupal::service('config.storage'), \Drupal::service('config.typed'), \Drupal::service('config.manager'), \Drupal::service('event_dispatcher'), NULL, \Drupal::service('extension.path.resolver'));
$config = $recipe->config;
// Create configuration that is either supplied by the recipe or listed in
// the config.import section that does not exist.
$config_installer->installRecipeConfig($config);
if (!empty($config->config['actions'])) {
$values = $recipe->input
->getValues();
// Wrap the replacement strings with `${` and `}`, which is a fairly
// common style of placeholder.
$keys = array_map(fn($k) => sprintf('${%s}', $k), array_keys($values));
$replace = array_combine($keys, $values);
// Process the actions.
/** @var \Drupal\Core\Config\Action\ConfigActionManager $config_action_manager */
$config_action_manager = \Drupal::service('plugin.manager.config_action');
foreach ($config->config['actions'] as $config_name => $actions) {
foreach ($actions as $action_id => $data) {
$config_action_manager->applyAction($action_id, $config_name, static::replaceInputValues($data, $replace));
}
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.