Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d7 / hook / node_validate.twig
diff --git a/vendor/chi-teck/drupal-code-generator/templates/d7/hook/node_validate.twig b/vendor/chi-teck/drupal-code-generator/templates/d7/hook/node_validate.twig
new file mode 100644 (file)
index 0000000..ac37efc
--- /dev/null
@@ -0,0 +1,10 @@
+/**
+ * Implements hook_node_validate().
+ */
+function {{ machine_name }}_node_validate($node, $form, &$form_state) {
+  if (isset($node->end) && isset($node->start)) {
+    if ($node->start > $node->end) {
+      form_set_error('time', t('An event may not end before it starts.'));
+    }
+  }
+}