3 namespace DrupalCodeGenerator\Command\Drupal_8;
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;
12 * Implements d8:theme command.
14 * @TODO: Create a test for this.
16 class Theme extends BaseGenerator {
18 protected $name = 'd8:theme';
19 protected $description = 'Generates Drupal 8 theme';
20 protected $alias = 'theme';
21 protected $destination = 'themes';
26 protected function interact(InputInterface $input, OutputInterface $output) {
27 $questions['name'] = new Question('Theme name');
28 $questions['machine_name'] = new Question('Theme machine name');
29 $questions['base_theme'] = new Question('Base theme', 'classy');
30 $questions['description'] = new Question('Description', 'A flexible theme with a responsive, mobile-first layout.');
31 $questions['package'] = new Question('Package', 'Custom');
33 $vars = $this->collectVars($input, $output, $questions);
34 $vars['base_theme'] = Utils::human2machine($vars['base_theme']);
36 $prefix = $vars['machine_name'] . '/' . $vars['machine_name'];
39 ->path($prefix . '.info.yml')
40 ->template('d8/yml/theme-info.twig');
43 ->path($prefix . '.libraries.yml')
44 ->template('d8/yml/theme-libraries.twig');
47 ->path($prefix . '.breakpoints.yml')
48 ->template('d8/yml/breakpoints.twig');
51 ->path($prefix . '.theme')
52 ->template('d8/theme.twig');
55 ->path('{machine_name}/js/' . str_replace('_', '-', $vars['machine_name']) . '.js')
56 ->template('d8/javascript.twig');
59 ->path('{machine_name}/theme-settings.php')
60 ->template('d8/theme-settings-form.twig');
63 ->path('{machine_name}/config/install/{machine_name}.settings.yml')
64 ->template('d8/theme-settings-config.twig');
67 ->path('{machine_name}/config/schema/{machine_name}.schema.yml')
68 ->template('d8/theme-settings-schema.twig');
71 ->path('{machine_name}/logo.svg')
72 ->template('d8/theme-logo.twig');
75 ->path('{machine_name}/templates');
78 ->path('{machine_name}/images');
82 'components/block.css',
83 'components/breadcrumb.css',
84 'components/field.css',
85 'components/form.css',
86 'components/header.css',
87 'components/menu.css',
88 'components/messages.css',
89 'components/node.css',
90 'components/sidebar.css',
91 'components/table.css',
92 'components/tabs.css',
93 'components/buttons.css',
97 foreach ($css_files as $file) {
99 ->path('{machine_name}/css/' . $file)