本文整理汇总了PHP中Drupal\Console\Style\DrupalStyle::title方法的典型用法代码示例。如果您正苦于以下问题:PHP DrupalStyle::title方法的具体用法?PHP DrupalStyle::title怎么用?PHP DrupalStyle::title使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Console\Style\DrupalStyle
的用法示例。
在下文中一共展示了DrupalStyle::title方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new DrupalStyle($input, $output);
$application = $this->getApplication();
$drupal = $this->getDrupalHelper();
// Provide drupal version if it's installed
$drupalVersion = $this->trans('commands.site.status.messages.not_installed');
if ($drupal->isInstalled()) {
$drupalVersion = sprintf($this->trans('commands.site.status.messages.current_version'), $this->getSite()->getDrupalVersion());
}
$aboutTitle = sprintf('%s (%s) | Supports Drupal (%s) | %s', $this->trans('commands.site.status.messages.console'), $application->getVersion(), $application::DRUPAL_SUPPORTED_VERSION, $drupalVersion);
$io->setDecorated(false);
$io->title($aboutTitle);
$io->setDecorated(true);
$commands = ['init' => [$this->trans('commands.init.description'), 'drupal init --override'], 'quick-start' => [$this->trans('commands.common.messages.quick-start'), 'drupal chain --file=~/.console/chain/quick-start.yml'], 'site-new' => [$this->trans('commands.site.new.description'), sprintf('drupal site:new drupal8.dev %s', $application::DRUPAL_SUPPORTED_VERSION)], 'site-install' => [$this->trans('commands.site.install.description'), sprintf('drupal site:install')], 'links' => [$this->trans('commands.list.description'), 'drupal list']];
foreach ($commands as $command => $commandInfo) {
$io->writeln($commandInfo[0]);
$io->newLine();
$io->comment(sprintf(' %s', $commandInfo[1]));
$io->newLine();
}
$io->setDecorated(false);
$io->section($this->trans('commands.self-update.description'));
$io->setDecorated(true);
$io->comment(' drupal self-update');
$io->newLine();
}
示例2: showMessage
/**
* @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->title($welcomeMessage);
}
}
示例3: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$output = new DrupalStyle($input, $output);
$application = $this->getApplication();
$aboutTitle = sprintf('%s (%s) | Supports Drupal %s', $this->trans('commands.site.status.messages.console'), $application->getVersion(), $application::DRUPAL_VERSION);
$output->setDecorated(false);
$output->title($aboutTitle);
$output->setDecorated(true);
$commands = ['init' => [$this->trans('commands.init.description'), 'drupal init [--override]'], 'quick-start' => [$this->trans('commands.common.messages.quick-start'), 'drupal chain --file=~/.console/chain/quick-start.yml'], 'site-new' => [$this->trans('commands.site.new.description'), sprintf('drupal site:new drupal8.dev %s', $application::DRUPAL_VERSION)], 'site-install' => [$this->trans('commands.site.install.description'), sprintf('drupal site:install')], 'links' => [$this->trans('commands.list.description'), 'drupal list']];
foreach ($commands as $command => $commandInfo) {
$output->writeln($commandInfo[0]);
$output->newLine();
$output->writeln(sprintf(' <comment>%s</comment>', $commandInfo[1]));
$output->newLine();
}
$output->setDecorated(false);
$output->section($this->trans('commands.self-update.description'));
$output->setDecorated(true);
$output->writeln(' <comment>drupal self-update</comment>');
$output->newLine();
}