Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d8 / hook / form_BASE_FORM_ID_alter.twig
diff --git a/vendor/chi-teck/drupal-code-generator/templates/d8/hook/form_BASE_FORM_ID_alter.twig b/vendor/chi-teck/drupal-code-generator/templates/d8/hook/form_BASE_FORM_ID_alter.twig
new file mode 100644 (file)
index 0000000..d3d5856
--- /dev/null
@@ -0,0 +1,15 @@
+/**
+ * Implements hook_form_BASE_FORM_ID_alter().
+ */
+function {{ machine_name }}_form_BASE_FORM_ID_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
+  // Modification for the form with the given BASE_FORM_ID goes here. For
+  // example, if BASE_FORM_ID is "node_form", this code would run on every
+  // node form, regardless of node type.
+
+  // Add a checkbox to the node form about agreeing to terms of use.
+  $form['terms_of_use'] = [
+    '#type' => 'checkbox',
+    '#title' => t("I agree with the website's terms and conditions."),
+    '#required' => TRUE,
+  ];
+}