summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorGábor Hojtsy <gabor@hojtsy.hu>2007-10-16 14:06:23 +0000
committerGábor Hojtsy <gabor@hojtsy.hu>2007-10-16 14:06:23 +0000
commit8a10f3ea220b4ad8e1d8244594031d918fb22b04 (patch)
tree95bc9d42b6ea3e02d50cf6e2abc4c696df3a40df /includes
parent79641f53120c469bc0bf1c4f2f216fb6f1623eaf (diff)
downloadbrdo-8a10f3ea220b4ad8e1d8244594031d918fb22b04.tar.gz
brdo-8a10f3ea220b4ad8e1d8244594031d918fb22b04.tar.bz2
#181328: pass on whole form to #process functions to enable advanced form handling (such as required by some CCK widgets)
Diffstat (limited to 'includes')
-rw-r--r--includes/form.inc15
1 files changed, 10 insertions, 5 deletions
diff --git a/includes/form.inc b/includes/form.inc
index 2a467076a..9c1062ef4 100644
--- a/includes/form.inc
+++ b/includes/form.inc
@@ -716,6 +716,8 @@ function form_error(&$element, $message = '') {
* $_POST data.
*/
function form_builder($form_id, $form, &$form_state) {
+ static $complete_form;
+
// Initialize as unprocessed.
$form['#processed'] = FALSE;
@@ -725,12 +727,15 @@ function form_builder($form_id, $form, &$form_state) {
$form += $info;
}
- if (isset($form['#type']) && $form['#type'] == 'form' && !empty($form['#programmed'])) {
- $form_state['submitted'] = TRUE;
+ if (isset($form['#type']) && $form['#type'] == 'form') {
+ $complete_form = $form;
+ if (!empty($form['#programmed'])) {
+ $form_state['submitted'] = TRUE;
+ }
}
if (isset($form['#input']) && $form['#input']) {
- _form_builder_handle_input_element($form_id, $form, $form_state);
+ _form_builder_handle_input_element($form_id, $form, $form_state, $complete_form);
}
$form['#defaults_loaded'] = TRUE;
@@ -796,7 +801,7 @@ function form_builder($form_id, $form, &$form_state) {
* can be processed and rendered. Also, execute any #process handlers
* attached to a specific element.
*/
-function _form_builder_handle_input_element($form_id, &$form, &$form_state) {
+function _form_builder_handle_input_element($form_id, &$form, &$form_state, $complete_form) {
if (!isset($form['#name'])) {
$name = array_shift($form['#parents']);
$form['#name'] = $name;
@@ -886,7 +891,7 @@ function _form_builder_handle_input_element($form_id, &$form, &$form_state) {
if (isset($form['#process']) && !$form['#processed']) {
foreach ($form['#process'] as $process) {
if (function_exists($process)) {
- $args = array_merge(array($form), array(isset($edit) ? $edit : NULL), array($form_state));
+ $args = array_merge(array($form), array(isset($edit) ? $edit : NULL), array($form_state), array($complete_form));
$form = call_user_func_array($process, $args);
}
}