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\ConfirmationQuestion;
10 use Symfony\Component\Console\Question\Question;
13 * Implements d8:template command.
15 class Template extends BaseGenerator {
17 protected $name = 'd8:template';
18 protected $description = 'Generates a template';
19 protected $alias = 'template';
24 protected function interact(InputInterface $input, OutputInterface $output) {
25 $questions = Utils::defaultQuestions();
26 $questions['template_name'] = new Question('Template name', 'example');
27 $questions['create_theme'] = new ConfirmationQuestion('Create theme hook?', TRUE);
28 $questions['create_preprocess'] = new ConfirmationQuestion('Create preprocess hook?', TRUE);
30 $vars = $this->collectVars($input, $output, $questions);
33 ->path('templates/{template_name}.html.twig')
34 ->template('d8/template-template.twig');
36 if ($vars['create_theme'] || $vars['create_preprocess']) {
38 ->path('{machine_name}.module')
39 ->template('d8/template-module.twig')