use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Drupal\Component\Serialization\Yaml;
use Drupal\Core\Config\CachedStorage;
InputArgument::OPTIONAL,
$this->trans('commands.debug.config.arguments.name')
)
+ ->addOption(
+ 'show-overridden',
+ null,
+ InputOption::VALUE_NONE,
+ $this->trans('commands.debug.config.options.show-overridden')
+ )
->setAliases(['dc']);
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$configName = $input->getArgument('name');
+ $showOverridden = $input->getOption('show-overridden');
+
if (!$configName) {
$this->getAllConfigurations();
} else {
- $this->getConfigurationByName($configName);
+ $this->getConfigurationByName($configName, $showOverridden);
}
}
}
/**
- * @param $config_name String
+ * @param $config_name String
+ * @param $showOverridden bool
*/
- private function getConfigurationByName($config_name)
+ private function getConfigurationByName($config_name, $showOverridden = false)
{
if ($this->configStorage->exists($config_name)) {
$tableHeader = [
$config_name,
];
-
$configuration = $this->configStorage->read($config_name);
+ if ($showOverridden) {
+ $configurationKeys = array_keys($configuration);
+ foreach ($configurationKeys as $configurationKey) {
+ $configuration[$configurationKey] = $this->configFactory
+ ->get($config_name)
+ ->get($configurationKey);
+ }
+ }
+
$configurationEncoded = Yaml::encode($configuration);
$tableRows = [];
$tableRows[] = [