You are here

function dialog_user_form_alter in Dialog 6

Same name and namespace in other branches
  1. 7 modules/dialog_user/dialog_user.module \dialog_user_form_alter()

Implementation of hook_form_alter().

File

modules/dialog_user/dialog_user.module, line 77

Code

function dialog_user_form_alter(&$form, $form_state, $form_id) {

  // Specify the submit buttons to be used as the dialog buttons.
  if ($form_id == 'user_login' && !empty($form_state['ajax'])) {
    $form['submit']['#attributes']['class'] = 'ctools-dialog-button';

    // Add links like the user_form_block does.
    $items = array();
    if (variable_get('user_register', 1)) {
      $items[] = l(t('Create new account'), 'user/register/nojs', array(
        'attributes' => array(
          'title' => t('Create a new user account.'),
          'class' => 'ctools-use-dialog',
        ),
      ));
    }
    $items[] = l(t('Request new password'), 'user/password/nojs', array(
      'attributes' => array(
        'title' => t('Request new password via e-mail.'),
        'class' => 'ctools-use-dialog',
      ),
    ));
    $form['links'] = array(
      '#value' => theme('item_list', $items),
    );
  }
  elseif ($form_id == 'user_register' && !empty($form_state['ajax'])) {
    $form['submit']['#attributes']['class'] = 'ctools-dialog-button';
  }
}