Skip to content

Commit f646fb7

Browse files
authored
Fix #3664. Make config:set --value_format=yaml work. (#3666)
1 parent 55f7264 commit f646fb7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Drupal/Commands/config/ConfigCommands.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,15 @@ public function get($config_name, $key = '', $options = ['format' => 'yaml', 'so
8080
* @param $config_name The config object name, for example "system.site".
8181
* @param $key The config key, for example "page.front".
8282
* @param $value The value to assign to the config key. Use '-' to read from STDIN.
83-
* @option format Format to parse the object. Use "string" for string (default), and "yaml" for YAML.
83+
* @option input-format Format to parse the object. Use "string" for string (default), and "yaml" for YAML.
8484
* // A convenient way to pass a multiline value within a backend request.
8585
* @option value The value to assign to the config key (if any).
8686
* @hidden-options value
8787
* @usage drush config:set system.site page.front node
8888
* Sets system.site:page.front to "node".
8989
* @aliases cset,config-set
9090
*/
91-
public function set($config_name, $key, $value = null, $options = ['format' => 'string', 'value' => self::REQ])
91+
public function set($config_name, $key, $value = null, $options = ['input-format' => 'string', 'value' => self::REQ])
9292
{
9393
// This hidden option is a convenient way to pass a value without passing a key.
9494
$data = $options['value'] ?: $value;
@@ -107,15 +107,15 @@ public function set($config_name, $key, $value = null, $options = ['format' => '
107107
}
108108

109109
// Now, we parse the value.
110-
switch ($options['format']) {
110+
switch ($options['input-format']) {
111111
case 'yaml':
112112
$parser = new Parser();
113113
$data = $parser->parse($data, true);
114114
}
115115

116116
if (is_array($data) && $this->io()->confirm(dt('Do you want to update or set multiple keys on !name config.', ['!name' => $config_name]))) {
117-
foreach ($data as $key => $value) {
118-
$config->set($key, $value);
117+
foreach ($data as $data_key => $value) {
118+
$config->set("$key.$data_key", $value);
119119
}
120120
return $config->save();
121121
} else {

0 commit comments

Comments
 (0)