コード例 #1
0
 /**
  * @param ConsoleCommandEvent $event
  */
 public function showMessage(ConsoleCommandEvent $event)
 {
     /**
      * @var \Drupal\Console\Command\Command $command
      */
     $command = $event->getCommand();
     $input = $event->getInput();
     $output = $event->getOutput();
     $output = new DrupalStyle($input, $output);
     $application = $command->getApplication();
     $translatorHelper = $application->getTranslator();
     $welcomeMessageKey = 'commands.' . str_replace(':', '.', $command->getName()) . '.welcome';
     $welcomeMessage = $translatorHelper->trans($welcomeMessageKey);
     if ($welcomeMessage != $welcomeMessageKey) {
         $output->text($welcomeMessage);
     }
 }