X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fchi-teck%2Fdrupal-code-generator%2Fsrc%2FCommand%2FDrupal_7%2FCToolsPlugin%2FBasePlugin.php;fp=vendor%2Fchi-teck%2Fdrupal-code-generator%2Fsrc%2FCommand%2FDrupal_7%2FCToolsPlugin%2FBasePlugin.php;h=c250d9b61ca7df8669d8792b5f98ad558f40fd9d;hp=0000000000000000000000000000000000000000;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0 diff --git a/vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/CToolsPlugin/BasePlugin.php b/vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/CToolsPlugin/BasePlugin.php new file mode 100644 index 000000000..c250d9b61 --- /dev/null +++ b/vendor/chi-teck/drupal-code-generator/src/Command/Drupal_7/CToolsPlugin/BasePlugin.php @@ -0,0 +1,49 @@ +setValidator([Utils::class, 'validateRequired']); + + $default_machine_name = function ($vars) { + return Utils::human2machine($vars['plugin_name']); + }; + $questions['plugin_machine_name'] = new Question('Plugin machine name', $default_machine_name); + $questions['plugin_machine_name']->setValidator([Utils::class, 'validateMachineName']); + + $questions['description'] = new Question('Plugin description', 'Plugin description.'); + $questions['category'] = new Question('Category', 'Custom'); + + $questions['context'] = new ChoiceQuestion( + 'Required context', + ['-', 'Node', 'User', 'Term'] + ); + + $this->collectVars($input, $output, $questions); + + $this->addFile() + ->path($this->subDirectory . '/{plugin_machine_name}.inc') + ->template($this->template); + } + +}