f026c821308b205a4f91cae0e2093b9cc58a18c2
[yaffs-website] / vendor / chi-teck / drupal-code-generator / src / Command / Drupal_8 / Yml / ThemeInfo.php
1 <?php
2
3 namespace DrupalCodeGenerator\Command\Drupal_8\Yml;
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 use Symfony\Component\Console\Question\Question;
10
11 /**
12  * Implements d8:yml:theme-info command.
13  */
14 class ThemeInfo extends BaseGenerator {
15
16   protected $name = 'd8:yml:theme-info';
17   protected $description = 'Generates a theme info yml file';
18   protected $alias = 'theme-info';
19   protected $destination = 'themes/%';
20
21   /**
22    * {@inheritdoc}
23    */
24   protected function interact(InputInterface $input, OutputInterface $output) {
25     $questions['name'] = new Question('Theme name');
26     $questions['name']->setValidator([Utils::class, 'validateRequired']);
27
28     $questions['machine_name'] = new Question('Theme machine name');
29     $questions['machine_name']->setValidator([Utils::class, 'validateMachineName']);
30
31     $questions['base_theme'] = new Question('Base theme', 'classy');
32     $questions['base_theme']->setValidator([Utils::class, 'validateMachineName']);
33
34     $questions['description'] = new Question('Description', 'A flexible theme with a responsive, mobile-first layout.');
35
36     $questions['package'] = new Question('Package', 'Custom');
37
38     $this->collectVars($input, $output, $questions);
39
40     $this->addFile()
41       ->path('{machine_name}.info.yml')
42       ->template('d8/yml/theme-info.twig');
43   }
44
45 }