function drush_config_get_value

8.0.x config.drush.inc drush_config_get_value($config_name, $key)
7.x config.drush.inc drush_config_get_value($config_name, $key)
master config.drush.inc drush_config_get_value($config_name, $key)

Show and return a value from config system.

Parameters

$config_name: The config name.

$key: The config key.

1 call to drush_config_get_value()
drush_config_get in commands/core/config.drush.inc
Config get command callback.

File

commands/core/config.drush.inc, line 885
Provides Configuration Management commands.

Code

function drush_config_get_value($config_name, $key) {
  $data = drush_config_get_object($config_name);
  $parts = explode('.', $key);
  if (count($parts) == 1) {
    $value = isset($data[$key]) ? $data[$key] : NULL;
  }
  else {
    $value = NestedArray::getValue($data, $parts, $key_exists);
    $value = $key_exists ? $value : NULL;
  }

  $returns[$config_name . ':' . $key] = $value;

  if ($value === NULL) {
    return drush_set_error('DRUSH_CONFIG_ERROR', dt('No matching key found in !name config.', array('!name' => $config_name)));
  }
  else {
    return $returns;
  }
}