Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d7 / hook / node_submit.twig
diff --git a/vendor/chi-teck/drupal-code-generator/templates/d7/hook/node_submit.twig b/vendor/chi-teck/drupal-code-generator/templates/d7/hook/node_submit.twig
new file mode 100644 (file)
index 0000000..b04ec0c
--- /dev/null
@@ -0,0 +1,10 @@
+/**
+ * Implements hook_node_submit().
+ */
+function {{ machine_name }}_node_submit($node, $form, &$form_state) {
+  // Decompose the selected menu parent option into 'menu_name' and 'plid', if
+  // the form used the default parent selection widget.
+  if (!empty($form_state['values']['menu']['parent'])) {
+    list($node->menu['menu_name'], $node->menu['plid']) = explode(':', $form_state['values']['menu']['parent']);
+  }
+}