5 * Contains \Drupal\Console\Generator\PluginTypeAnnotationGenerator.
8 namespace Drupal\Console\Generator;
10 use Drupal\Console\Core\Generator\Generator;
11 use Drupal\Console\Extension\Manager;
13 class PluginTypeAnnotationGenerator extends Generator
18 protected $extensionManager;
21 * PluginTypeAnnotationGenerator constructor.
23 * @param Manager $extensionManager
25 public function __construct(
26 Manager $extensionManager
28 $this->extensionManager = $extensionManager;
32 * Generator for Plugin type with annotation discovery.
36 * @param $machine_name
39 public function generate($module, $class_name, $machine_name, $label)
43 'class_name' => $class_name,
44 'machine_name' => $machine_name,
46 'file_exists' => file_exists($this->extensionManager->getModule($module)->getPath() .'/'.$module.'.services.yml'),
49 $directory = $this->extensionManager->getModule($module)->getSourcePath() . '/Plugin/' . $class_name;
51 if (!is_dir($directory)) {
52 mkdir($directory, 0777, true);
56 'module/src/Annotation/plugin-type.php.twig',
57 $this->extensionManager->getModule($module)->getSourcePath() . '/Annotation/' . $class_name . '.php',
62 'module/src/plugin-type-annotation-base.php.twig',
63 $this->extensionManager->getModule($module)->getSourcePath() .'/Plugin/' . $class_name . 'Base.php',
68 'module/src/plugin-type-annotation-interface.php.twig',
69 $this->extensionManager->getModule($module)->getSourcePath() .'/Plugin/' . $class_name . 'Interface.php',
74 'module/src/plugin-type-annotation-manager.php.twig',
75 $this->extensionManager->getModule($module)->getSourcePath() .'/Plugin/' . $class_name . 'Manager.php',
79 'module/plugin-annotation-services.yml.twig',
80 $this->extensionManager->getModule($module)->getPath() . '/' . $module . '.services.yml',