/**
* @file
- * Contains \Drupal\Console\Command\Theme\Debugommand.
+ * Contains \Drupal\Console\Command\Debug\ThemeCommand.
*/
-namespace Drupal\Console\Command\Theme;
+namespace Drupal\Console\Command\Debug;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
-use Symfony\Component\Console\Command\Command;
-use Drupal\Console\Core\Command\Shared\CommandTrait;
+use Drupal\Console\Core\Command\Command;
use Drupal\Core\Config\ConfigFactory;
use Drupal\Core\Extension\ThemeHandler;
-use Drupal\Console\Core\Style\DrupalStyle;
-class DebugCommand extends Command
+class ThemeCommand extends Command
{
- use CommandTrait;
-
/**
* @var ConfigFactory
*/
protected function configure()
{
$this
- ->setName('theme:debug')
- ->setDescription($this->trans('commands.theme.debug.description'))
- ->addArgument('theme', InputArgument::OPTIONAL, $this->trans('commands.theme.debug.arguments.theme'));
+ ->setName('debug:theme')
+ ->setDescription($this->trans('commands.debug.theme.description'))
+ ->addArgument(
+ 'theme',
+ InputArgument::OPTIONAL,
+ $this->trans('commands.debug.theme.arguments.theme')
+ )
+ ->setAliases(['dt']);
}
protected function execute(InputInterface $input, OutputInterface $output)
{
- $io = new DrupalStyle($input, $output);
-
$theme = $input->getArgument('theme');
if ($theme) {
- $this->themeDetail($io, $theme);
+ $this->themeDetail($theme);
} else {
- $this->themeList($io);
+ $this->themeList();
}
}
- protected function themeList(DrupalStyle $io)
+ protected function themeList()
{
$tableHeader = [
- $this->trans('commands.theme.debug.messages.theme-id'),
- $this->trans('commands.theme.debug.messages.theme-name'),
- $this->trans('commands.theme.debug.messages.status'),
- $this->trans('commands.theme.debug.messages.version'),
+ $this->trans('commands.debug.theme.messages.theme-id'),
+ $this->trans('commands.debug.theme.messages.theme-name'),
+ $this->trans('commands.debug.theme.messages.status'),
+ $this->trans('commands.debug.theme.messages.version'),
];
$themes = $this->themeHandler->rebuildThemeData();
];
}
- $io->table($tableHeader, $tableRows);
+ $this->getIo()->table($tableHeader, $tableRows);
}
- protected function themeDetail(DrupalStyle $io, $themeId)
+ protected function themeDetail($themeId)
{
$theme = null;
$themes = $this->themeHandler->rebuildThemeData();
$theme = $themes[$themeId];
$status = $this->getThemeStatus($themeId);
- $io->info($theme->info['name']);
+ $this->getIo()->info($theme->info['name']);
- $io->comment(
+ $this->getIo()->comment(
sprintf(
'%s : ',
- $this->trans('commands.theme.debug.messages.status')
+ $this->trans('commands.debug.theme.messages.status')
),
false
);
- $io->writeln($status);
- $io->comment(
+ $this->getIo()->writeln($status);
+ $this->getIo()->comment(
sprintf(
'%s : ',
- $this->trans('commands.theme.debug.messages.version')
+ $this->trans('commands.debug.theme.messages.version')
),
false
);
- $io->writeln($theme->info['version']);
- $io->comment($this->trans('commands.theme.debug.messages.regions'));
+ $this->getIo()->writeln($theme->info['version']);
+ $this->getIo()->comment($this->trans('commands.debug.theme.messages.regions'));
$tableRows = $this->addThemeAttributes($theme->info['regions'], $tableRows);
- $io->table([], $tableRows);
+ $this->getIo()->table([], $tableRows);
} else {
- $io->error(
+ $this->getIo()->error(
sprintf(
- $this->trans('commands.theme.debug.messages.invalid-theme'),
+ $this->trans('commands.debug.theme.messages.invalid-theme'),
$themeId
)
);
{
$defaultTheme = $this->configFactory->get('system.theme')->get('default');
- $status = ($theme->status)?$this->trans('commands.theme.debug.messages.installed'):$this->trans('commands.theme.debug.messages.uninstalled');
+ $status = ($theme->status)?$this->trans('commands.debug.theme.messages.installed'):$this->trans('commands.debug.theme.messages.uninstalled');
if ($defaultTheme == $theme) {
- $status = $this->trans('commands.theme.debug.messages.default-theme');
+ $status = $this->trans('commands.debug.theme.messages.default-theme');
}
return $status;