Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / drupal / console / src / Command / Debug / ConfigCommand.php
index 1af54628d244bd4e5bcb95ad408fc31ae5307794..129f097fc2003f4a4346a6961b04a0ec6c25ebdb 100644 (file)
@@ -9,6 +9,7 @@ namespace Drupal\Console\Command\Debug;
 
 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;
@@ -55,6 +56,12 @@ class ConfigCommand extends Command
                 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']);
     }
 
@@ -64,10 +71,12 @@ class ConfigCommand extends Command
     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);
         }
     }
 
@@ -88,16 +97,25 @@ class ConfigCommand extends Command
     }
 
     /**
-     * @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[] = [