Security update for Core, with self-updated composer
[yaffs-website] / vendor / drupal / console / src / Generator / PluginFieldWidgetGenerator.php
1 <?php
2
3 /**
4  * @file
5  * Contains \Drupal\Console\Generator\PluginFieldWidgetGenerator.
6  */
7
8 namespace Drupal\Console\Generator;
9
10 use Drupal\Console\Core\Generator\Generator;
11 use Drupal\Console\Extension\Manager;
12
13 class PluginFieldWidgetGenerator extends Generator
14 {
15
16     /**
17      * @var Manager
18      */
19     protected $extensionManager;
20
21     /**
22      * PluginFieldWidgetGenerator constructor.
23      *
24      * @param Manager $extensionManager
25      */
26     public function __construct(
27         Manager $extensionManager
28     ) {
29         $this->extensionManager = $extensionManager;
30     }
31
32     /**
33      * {@inheritdoc}
34      */
35     public function generate(array $parameters)
36     {
37         $module = $parameters['module'];
38         $class_name = $parameters['class_name'];
39
40         $this->renderFile(
41             'module/src/Plugin/Field/FieldWidget/fieldwidget.php.twig',
42             $this->extensionManager->getPluginPath($module, 'Field/FieldWidget') . '/' . $class_name . '.php',
43             $parameters
44         );
45     }
46 }