summaryrefslogtreecommitdiff
path: root/includes/form.inc
diff options
context:
space:
mode:
Diffstat (limited to 'includes/form.inc')
-rw-r--r--includes/form.inc15
1 files changed, 14 insertions, 1 deletions
diff --git a/includes/form.inc b/includes/form.inc
index fcadc3c36..4b8972a01 100644
--- a/includes/form.inc
+++ b/includes/form.inc
@@ -459,7 +459,20 @@ function form_state_keys_no_cache() {
* Any additional arguments are passed on to the functions called by
* drupal_form_submit(), including the unique form constructor function.
* For example, the node_edit form requires that a node object be passed
- * in here when it is called.
+ * in here when it is called. Arguments that need to be passed by reference
+ * should not be included here, but rather placed directly in the $form_state
+ * build info array so that the reference can be preserved. For example, a
+ * form builder function with the following signature:
+ * @code
+ * function mymodule_form($form, &$form_state, &$object) {
+ * }
+ * @endcode
+ * would be called via drupal_form_submit() as follows:
+ * @code
+ * $form_state['values'] = $my_form_values;
+ * $form_state['build_info']['args'] = array(&$object);
+ * drupal_form_submit('mymodule_form', $form_state);
+ * @endcode
* For example:
* @code
* // register a new user