コード例 #1
0
 /**
  * {@inheritdoc}
  */
 protected function interact(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $name = $input->getArgument('name');
     $names = $this->configFactory->listAll();
     if ($name) {
         if (!in_array($name, $names)) {
             $io->warning(sprintf($this->trans('commands.config.override.messages.invalid-name'), $name));
             $name = null;
         }
     }
     if (!$name) {
         $name = $io->choiceNoList($this->trans('commands.config.override.questions.name'), $names);
         $input->setArgument('name', $name);
     }
     $key = $input->getArgument('key');
     if (!$key) {
         if ($this->configStorage->exists($name)) {
             $configuration = $this->configStorage->read($name);
         }
         $key = $io->choiceNoList($this->trans('commands.config.override.questions.key'), array_keys($configuration));
         $input->setArgument('key', $key);
     }
     $value = $input->getArgument('value');
     if (!$value) {
         $value = $io->ask($this->trans('commands.config.override.questions.value'));
         $input->setArgument('value', $value);
     }
 }
コード例 #2
0
ファイル: DebugCommand.php プロジェクト: jeyram/DrupalConsole
 /**
  * @param $io             DrupalStyle
  * @param $config_name    String
  */
 private function getConfigurationByName(DrupalStyle $io, $config_name)
 {
     if ($this->configStorage->exists($config_name)) {
         $tableHeader = [$config_name];
         $configuration = $this->configStorage->read($config_name);
         $configurationEncoded = Yaml::encode($configuration);
         $tableRows = [];
         $tableRows[] = [$configurationEncoded];
         $io->table($tableHeader, $tableRows, 'compact');
     } else {
         $io->error(sprintf($this->trans('commands.config.debug.errors.not-exists'), $config_name));
     }
 }
コード例 #3
0
 /**
  * @param $config_name String
  *
  * @return array
  */
 protected function getYamlConfig($config_name)
 {
     if ($this->configStorage->exists($config_name)) {
         $configuration = $this->configStorage->read($config_name);
         $configurationEncoded = Yaml::encode($configuration);
     }
     return $configurationEncoded;
 }