, Drupal API user_register(). , ; .
- . : , , ..: . API API .
: . .
fieldset: . , .
, , : , . -, , . :
$form['name'] = array(
'#type' => 'textfield',
'#title' => t('Name'),
'#weight' => 1,
);
$form['company'] = array(
'#type' => 'textfield',
'#title' => t('Company'),
'#weight' => 2,
);
$form['email'] = array(
'#type' => 'textfield',
'#title' => t('E-mail address'),
'#weight' => 3,
);
#weight. , , $form['company']['#weight'] , 3.
, Personal Information. :
$form['personal'] = array(
'#type' => 'fieldset',
'#title' => t('Personal information'),
'#weight' => 1,
);
$form['personal']['name'] = array(
'#type' => 'textfield',
'#title' => t('Name'),
'#weight' => 1,
);
$form['personal']['company'] = array(
'#type' => 'textfield',
'#title' => t('Company'),
'#weight' => 2,
);
$form['email'] = array(
'#type' => 'textfield',
'#title' => t('E-mail address'),
'#weight' => 3,
);
, $form['personal'].
, , #weight 2. , #weight, , $form['personal']['name']['#weight'] 4, .
, , hook_form_alter(), user_register, , .
, . hook_form_alter():
function test_form_alter(&$form, $form_state, $form_id) {
if ($form_id === 'user_register') {
$form['name']['#weight'] = 2;
$form['mail']['#weight'] = 1;
$form['personal_info'] = array(
'#type' => 'fieldset',
'#title' => t('Personal information'),
);
$form['personal_info']['name'] = $form['name'];
$form['personal_info']['mail'] = $form['mail'];
unset($form['name']);
unset($form['mail']);
}
}
. , $form['name'] $form['group']['name'], $form['other_group']['name']. user_register , # tree #parents .
: , Content Profile. , , . : README, , .