Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d8 / template-module.twig
diff --git a/vendor/chi-teck/drupal-code-generator/templates/d8/template-module.twig b/vendor/chi-teck/drupal-code-generator/templates/d8/template-module.twig
new file mode 100644 (file)
index 0000000..da322d1
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+
+/**
+ * @file
+ * Primary module hooks for {{ name }} module.
+ */
+{% if create_theme %}
+
+/**
+ * Implements hook_theme().
+ */
+function {{ machine_name }}_theme() {
+  return [
+    '{{ template_name|h2u }}' => [
+      'variables' => ['foo' => NULL],
+    ],
+  ];
+}
+{% endif %}
+{% if create_preprocess %}
+
+/**
+ * Prepares variables for {{ template_name }} template.
+ *
+ * Default template: {{ template_name }}.html.twig.
+ *
+ * @param array $variables
+ *   An associative array containing:
+ *   - foo: Foo variable description.
+ */
+function template_preprocess_{{ template_name|h2u }}(array &$variables) {
+  $variables['foo'] = 'bar';
+}
+{% endif %}