From 11b98e4f60ef2b5f44acec824a19386235f79dba Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Sun, 10 Jan 2010 22:45:58 +0000 Subject: #637712 by c960657 and Dave Reid: Fixed Fieldset is back in user registration form. --- modules/user/user.module | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'modules/user/user.module') diff --git a/modules/user/user.module b/modules/user/user.module index 745d4abd1..3361f06e9 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -3100,6 +3100,8 @@ function user_register_form($form, &$form_state) { $form['#attached']['library'][] = array('system', 'cookie'); $form['#attributes']['class'][] = 'user-info-from-cookie'; + $form['#pre_render'] = array('user_register_form_pre_render'); + // Start with the default user account fields. user_account_form($form, $form_state); @@ -3109,14 +3111,6 @@ function user_register_form($form, &$form_state) { $form_state['redirect'] = $_GET['q']; } - // If the "account" fieldset is the only element at the top level, its - // borders are hidden for aesthetic reasons. We do not remove the fieldset but - // preserve the form structure so that modules implementing - // hook_form_FORM_ID_alter() know where to find the basic elements. - if (count(element_children($form)) == 1) { - $form['account']['#type'] = 'markup'; - } - $form['submit'] = array( '#type' => 'submit', '#value' => t('Create new account'), @@ -3129,6 +3123,20 @@ function user_register_form($form, &$form_state) { return $form; } +/** + * Form pre-render callback to clean up the user_register_form. + * + * If the "account" fieldset is the only element at the top level (apart from + * the submit button), its borders are hidden for aesthetic reasons. + */ +function user_register_form_pre_render($form) { + $visible_children = element_get_visible_children($form); + if (!count(array_diff($visible_children, array('account', 'submit')))) { + $form['account']['#theme_wrappers'] = array(); + } + return $form; +} + /** * Submit handler for the user registration form. * -- cgit v1.2.3