73da7af5c386929e7a7cb66e4d37cd453e5c6a1d
[yaffs-website] / vendor / chi-teck / drupal-code-generator / src / Command / Drupal_8 / Plugin / Views / Style.php
1 <?php
2
3 namespace DrupalCodeGenerator\Command\Drupal_8\Plugin\Views;
4
5 use DrupalCodeGenerator\Command\BaseGenerator;
6 use DrupalCodeGenerator\Utils;
7 use Symfony\Component\Console\Input\InputInterface;
8 use Symfony\Component\Console\Output\OutputInterface;
9
10 /**
11  * Implements d8:plugin:views:style command.
12  */
13 class Style extends BaseGenerator {
14
15   protected $name = 'd8:plugin:views:style';
16   protected $description = 'Generates views style plugin';
17   protected $alias = 'views-style';
18
19   /**
20    * {@inheritdoc}
21    */
22   protected function interact(InputInterface $input, OutputInterface $output) {
23     $questions = Utils::defaultPluginQuestions();
24
25     $vars = &$this->collectVars($input, $output, $questions);
26     $vars['class'] = Utils::camelize($vars['plugin_label']);
27
28     $this->addFile()
29       ->path('src/Plugin/views/style/{class}.php')
30       ->template('d8/plugin/views/style-plugin.twig');
31
32     $this->addFile()
33       ->path('templates/views-style-' . str_replace('_', '-', $vars['plugin_id']) . '.html.twig')
34       ->template('d8/plugin/views/style-template.twig');
35
36     $this->addFile()
37       ->path('{machine_name}.module')
38       ->headerTemplate('d8/file-docs/module.twig')
39       ->template('d8/plugin/views/style-preprocess.twig')
40       ->action('append')
41       ->headerSize(7);
42   }
43
44 }