summaryrefslogtreecommitdiff
path: root/includes/form.inc
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-10-13 16:38:43 +0000
committerDries Buytaert <dries@buytaert.net>2009-10-13 16:38:43 +0000
commitfbfa7a4150a40d6df9347692bb6681f45f804c7d (patch)
tree425db0f6cc7b72b8a9350c5a462fe718e0ed2877 /includes/form.inc
parentf67e438b4196a6bc79c0da576da0a9e09fedb612 (diff)
downloadbrdo-fbfa7a4150a40d6df9347692bb6681f45f804c7d.tar.gz
brdo-fbfa7a4150a40d6df9347692bb6681f45f804c7d.tar.bz2
- Patch #593522 by sun: a better and faster drupal_alter().
Diffstat (limited to 'includes/form.inc')
-rw-r--r--includes/form.inc19
1 files changed, 5 insertions, 14 deletions
diff --git a/includes/form.inc b/includes/form.inc
index 282f3a1b1..96a182f64 100644
--- a/includes/form.inc
+++ b/includes/form.inc
@@ -670,20 +670,11 @@ function drupal_prepare_form($form_id, &$form, &$form_state) {
}
}
- // Normally, we would call drupal_alter($form_id, $form, $form_state).
- // However, drupal_alter() normally supports just one byref parameter. Using
- // the __drupal_alter_by_ref key, we can store any additional parameters
- // that need to be altered, and they'll be split out into additional params
- // for the hook_form_alter() implementations.
- // @todo: Remove this in Drupal 7.
- $data = &$form;
- $data['__drupal_alter_by_ref'] = array(&$form_state);
- drupal_alter('form_' . $form_id, $data);
-
- // __drupal_alter_by_ref is unset in the drupal_alter() function, we need
- // to repopulate it to ensure both calls get the data.
- $data['__drupal_alter_by_ref'] = array(&$form_state);
- drupal_alter('form', $data, $form_id);
+ // Invoke hook_form_FORM_ID_alter() implementations.
+ drupal_alter('form_' . $form_id, $form, $form_state);
+
+ // Invoke hook_form_alter() implementations.
+ drupal_alter('form', $form, $form_state, $form_id);
}