/**
* Implements hook_form_alter
*/
function mymodule_form_alter(&$form, &$form_state, $form_id) {
switch ($form_id) {
case 'user_pass': // user pass page
$form['name']['#title'] = t('请输入您的注册邮箱:');
$form['name']['#description'] = '';
$form['actions']['submit']['#value'] = t('确认>');
// $form['name']['#attributes'] = array('placeholder' => array(t('Your e-mail')));
break;
case 'user_login': // user login page
$form['name']['#size'] = 30;
$form['pass']['#size'] = 30;
$form['actions']['submit']['#value'] = t('确认提交');
$form['#attributes'] = array('class' => array('user-login'));
/*$form['name']['#attributes'] = array('placeholder' => array(t('用户名或邮箱地址')));
$form['pass']['#attributes'] = array('placeholder' => array(t('输入您的登录密码')));*/
if (arg(0) && arg(1) && arg(0) == 'user' && arg(1) == 'login') {
// drupal_set_title(t('登录'));
$form['name']['#title'] = t('用户名或邮箱地址');
$form['pass']['#title'] = t('输入您的登录密码');
unset($form['name']['#description']);
unset($form['pass']['#description']);
}
break;
case 'user_register_form':
// dpm($form);
$form['account']['name']['#access'] = TRUE;
$form['account']['name']['#title'] = t('用户名');
unset($form['account']['name']['#description']);
$form['account']['mail']['#title'] = t('电子邮箱');
$form['actions']['submit']['#value'] = t('提交>');
unset($form['field_gender']['und']['#options']['_none']);
unset($form['account']['mail']['#description']);
unset($form['account']['current_pass']['#description']);
unset($form['account']['pass']['#description']);
$form['name'] = $form['account']['name'];
$form['name']['#weight'] = 6;
unset($form['account']['name']);
if (variable_get('nocurrent_pass_disabled', TRUE)) {
// searches the #validate array for the current_pass validation function, and removes it
$key = array_search('user_validate_current_pass', $form['#validate']);
if ($key !== FALSE) {
unset($form['#validate'][$key]);
}
// hide the current password fields
$form['account']['current_pass_required_value']['#access'] = FALSE;
$form['account']['current_pass']['#access'] = FALSE;
}
$form['contract']=array(
'#markup' => theme('user_register_contract'),
'#weight' => 14
);
$form['argee'] = array(
'#type' => 'checkbox',
'#title' => t('我同意协议内容'),
// '#description' => t('我同意协议内容'),
'#required' => TRUE,
'#weight' => 15
);
// dpm($form);
$form['actions']['#weight'] = 20;
$form['actions']['submit']['#states'] = array(
// Hide the settings when the cancel notify checkbox is disabled.
'disabled' => array(
':input[name="argee"]' => array('checked' => FALSE),
),
);
break;
}
}