8f9a20cd9f4303b8cdbf5fae276337b8973f1056
[yaffs-website] / vendor / chi-teck / drupal-code-generator / src / Command / Drupal_8 / RenderElement.php
1 <?php
2
3 namespace DrupalCodeGenerator\Command\Drupal_8;
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:render-element command.
13  */
14 class RenderElement extends BaseGenerator {
15
16   protected $name = 'd8:render-element';
17   protected $description = 'Generates Drupal 8 render element';
18   protected $alias = 'render-element';
19
20   /**
21    * {@inheritdoc}
22    */
23   protected function interact(InputInterface $input, OutputInterface $output) {
24     $questions['machine_name'] = new Question('Module machine name');
25     $questions['machine_name']->setValidator([Utils::class, 'validateMachineName']);
26     $this->collectVars($input, $output, $questions);
27     $this->addFile()
28       ->path('src/Element/Entity.php')
29       ->template('d8/render-element.twig');
30   }
31
32 }