5 * Contains \Drupal\Console\Command\Views\PluginsDebugCommand.
8 namespace Drupal\Console\Command\Views;
10 use Symfony\Component\Console\Input\InputArgument;
11 use Symfony\Component\Console\Input\InputInterface;
12 use Symfony\Component\Console\Output\OutputInterface;
13 use Symfony\Component\Console\Command\Command;
14 use Drupal\Console\Core\Command\Shared\ContainerAwareCommandTrait;
15 use Drupal\Console\Core\Style\DrupalStyle;
16 use Drupal\views\Views;
19 * Class PluginsDebugCommand
21 * @package Drupal\Console\Command\Views
23 class PluginsDebugCommand extends Command
25 use ContainerAwareCommandTrait;
29 protected function configure()
32 ->setName('views:plugins:debug')
33 ->setDescription($this->trans('commands.views.plugins.debug.description'))
36 InputArgument::OPTIONAL,
37 $this->trans('commands.views.plugins.debug.arguments.type')
44 protected function execute(InputInterface $input, OutputInterface $output)
46 $io = new DrupalStyle($input, $output);
47 $type = $input->getArgument('type');
49 $this->pluginList($io, $type);
53 * @param \Drupal\Console\Core\Style\DrupalStyle $io
56 protected function pluginList(DrupalStyle $io, $type)
58 $plugins = Views::pluginList();
61 foreach ($plugins as &$plugin) {
62 if ($type && $plugin['type'] != $type) {
67 // Link each view name to the view itself.
68 foreach ($plugin['views'] as $plugin_name => $view) {
71 $rows[] = [$plugin['type'], $plugin['title'], $plugin['provider'], implode(",", $views)];
74 // Sort rows by field name.
79 $this->trans('commands.views.plugins.debug.messages.type'),
80 $this->trans('commands.views.plugins.debug.messages.name'),
81 $this->trans('commands.views.plugins.debug.messages.provider'),
82 $this->trans('commands.views.plugins.debug.messages.views'),
85 $io->table($tableHeader, $rows, 'compact');