From fbfa7a4150a40d6df9347692bb6681f45f804c7d Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Tue, 13 Oct 2009 16:38:43 +0000 Subject: - Patch #593522 by sun: a better and faster drupal_alter(). --- includes/form.inc | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'includes/form.inc') 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); } -- cgit v1.2.3