Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/Drupal/Commands/config/ConfigCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ public function get($config_name, $key = '', $options = ['format' => 'yaml', 'so
* @param $config_name The config object name, for example "system.site".
* @param $key The config key, for example "page.front".
* @param $value The value to assign to the config key. Use '-' to read from STDIN.
* @option format Format to parse the object. Use "string" for string (default), and "yaml" for YAML.
* @option value_format Format to parse the object. Use "string" for string (default), and "yaml" for YAML.
* // A convenient way to pass a multiline value within a backend request.
* @option value The value to assign to the config key (if any).
* @hidden-options value
* @usage drush config:set system.site page.front node
* Sets system.site:page.front to "node".
* @aliases cset,config-set
*/
public function set($config_name, $key, $value = null, $options = ['format' => 'string', 'value' => self::REQ])
public function set($config_name, $key, $value = null, $options = ['value_format' => 'string', 'value' => self::REQ])
{
// This hidden option is a convenient way to pass a value without passing a key.
$data = $options['value'] ?: $value;
Expand All @@ -107,15 +107,15 @@ public function set($config_name, $key, $value = null, $options = ['format' => '
}

// Now, we parse the value.
switch ($options['format']) {
switch ($options['value_format']) {
case 'yaml':
$parser = new Parser();
$data = $parser->parse($data, true);
}

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