summaryrefslogtreecommitdiff
path: root/modules/node/node.api.php
diff options
context:
space:
mode:
Diffstat (limited to 'modules/node/node.api.php')
-rw-r--r--modules/node/node.api.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/modules/node/node.api.php b/modules/node/node.api.php
index 95dc3b2b1..690fb9e39 100644
--- a/modules/node/node.api.php
+++ b/modules/node/node.api.php
@@ -665,6 +665,34 @@ function hook_node_validate($node, $form) {
}
/**
+ * Act on a node after validated form values have been copied to it.
+ *
+ * This hook is invoked when a node form is submitted with either the "Save" or
+ * "Preview" button, after form values have been copied to the form state's node
+ * object, but before the node is saved or previewed. It is a chance for modules
+ * to adjust the node's properties from what they are simply after a copy from
+ * $form_state['values']. This hook is intended for adjusting non-field-related
+ * properties. See hook_field_attach_submit() for customizing field-related
+ * properties.
+ *
+ * @param $node
+ * The node being updated in response to a form submission.
+ * @param $form
+ * The form being used to edit the node.
+ * @param $form_state
+ * The form state array.
+ *
+ * @ingroup node_api_hooks
+ */
+function hook_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']);
+ }
+}
+
+/**
* Act on a node that is being assembled before rendering.
*
* The module may add elements to $node->content prior to rendering. This hook