function dialog_user_form_alter in Dialog 7
Same name and namespace in other branches
- 6 modules/dialog_user/dialog_user.module \dialog_user_form_alter()
Implement hook_form_alter().
File
- modules/
dialog_user/ dialog_user.module, line 65
Code
function dialog_user_form_alter(&$form, &$form_state, $form_id) {
$forms = array(
'user_register_form',
'user_pass',
'user_login',
);
if (in_array($form_id, $forms)) {
if (dialog_display() || isset($form_state['values']['dialog_display'])) {
$form['dialog_display'] = array(
'#type' => 'value',
'#value' => TRUE,
);
$form['#prefix'] = '<div id="dialog-form-wrapper">';
$form['#suffix'] = '</div>';
// Make enter press work on textfields.
$textfields = array(
'name',
'pass',
'email',
);
foreach ($textfields as $textfield) {
if (isset($form[$textfield])) {
$form[$textfield]['#ajax'] = array(
'event' => '',
'keypress' => TRUE,
'callback' => 'drupal_render',
'wrapper' => 'dialog-form-wrapper',
);
}
if (isset($form['account'][$textfield])) {
$form['account'][$textfield]['#ajax'] = array(
'event' => '',
'keypress' => TRUE,
'callback' => 'drupal_render',
'wrapper' => 'dialog-form-wrapper',
);
}
}
$form['submit']['#ajax'] = array(
'callback' => 'drupal_render',
'wrapper' => 'dialog-form-wrapper',
);
$form['#submit'][] = 'dialog_user_ajax_form_submit';
$form['#process'][] = 'dialog_process_ajax_form';
}
}
}