forked from a64f7bb4-7358-4778-9fbe-3b882c34cc1d/v1
32 lines
769 B
Twig
32 lines
769 B
Twig
<?php
|
|
|
|
namespace {{ namespace }};
|
|
|
|
use DrupalCodeGenerator\Command\ModuleGenerator;
|
|
|
|
/**
|
|
* Implements {{ command_name }} command.
|
|
*/
|
|
class {{ class }} extends ModuleGenerator {
|
|
|
|
protected string $name = '{{ command_name }}';
|
|
protected string $description = '{{ description }}';
|
|
protected string $alias = '{{ alias }}';
|
|
protected string $templatePath = __DIR__;
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
protected function generate(array &$vars) :void {
|
|
$this->collectDefault($vars);
|
|
$vars['class'] = $this->ask('Class', '{machine_name|camelize}');
|
|
|
|
// @DCG The template should be located under directory specified in
|
|
// $this->templatePath variable.
|
|
$this->addFile()
|
|
->path('src/{class}.php')
|
|
->template('{{ template_name }}');
|
|
}
|
|
|
|
}
|