Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / src / Command / Drupal_8 / ThemeFile.php
diff --git a/vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/ThemeFile.php b/vendor/chi-teck/drupal-code-generator/src/Command/Drupal_8/ThemeFile.php
new file mode 100644 (file)
index 0000000..c99f362
--- /dev/null
@@ -0,0 +1,37 @@
+<?php
+
+namespace DrupalCodeGenerator\Command\Drupal_8;
+
+use DrupalCodeGenerator\Command\BaseGenerator;
+use DrupalCodeGenerator\Utils;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Console\Question\Question;
+
+/**
+ * Implements d8:theme-file command.
+ */
+class ThemeFile extends BaseGenerator {
+
+  protected $name = 'd8:theme-file';
+  protected $description = 'Generates a theme file';
+  protected $alias = 'theme-file';
+  protected $destination = 'themes/%';
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function interact(InputInterface $input, OutputInterface $output) {
+    $questions['name'] = new Question('Theme name');
+    $questions['name']->setValidator([Utils::class, 'validateRequired']);
+    $questions['machine_name'] = new Question('Theme machine name');
+    $questions['machine_name']->setValidator([Utils::class, 'validateMachineName']);
+
+    $this->collectVars($input, $output, $questions);
+
+    $this->addFile()
+      ->path('{machine_name}.theme')
+      ->template('d8/theme.twig');
+  }
+
+}