function _openid_user_login_form_alter in Drupal 7
2 calls to _openid_user_login_form_alter()
- openid_form_user_login_alter in modules/
openid/ openid.module - Implements hook_form_FORM_ID_alter().
- openid_form_user_login_block_alter in modules/
openid/ openid.module - Implements hook_form_FORM_ID_alter().
File
- modules/
openid/ openid.module, line 136 - Implement OpenID Relying Party support for Drupal
Code
function _openid_user_login_form_alter(&$form, &$form_state) {
$form['#attached']['css'][] = drupal_get_path('module', 'openid') . '/openid.css';
$form['#attached']['js'][] = drupal_get_path('module', 'openid') . '/openid.js';
$form['#attached']['library'][] = array(
'system',
'jquery.cookie',
);
if (!empty($form_state['input']['openid_identifier'])) {
$form['name']['#required'] = FALSE;
$form['pass']['#required'] = FALSE;
unset($form['#submit']);
$form['#validate'] = array(
'openid_login_validate',
);
}
$items = array();
$items[] = array(
'data' => l(t('Log in using OpenID'), '#openid-login', array(
'external' => TRUE,
)),
'class' => array(
'openid-link',
),
);
$items[] = array(
'data' => l(t('Cancel OpenID login'), '#', array(
'external' => TRUE,
)),
'class' => array(
'user-link',
),
);
$form['openid_links'] = array(
'#theme' => 'item_list',
'#items' => $items,
'#attributes' => array(
'class' => array(
'openid-links',
),
),
'#weight' => 1,
);
$form['links']['#weight'] = 2;
$form['openid_identifier'] = array(
'#type' => 'textfield',
'#title' => t('Log in using OpenID'),
'#size' => $form['name']['#size'],
'#maxlength' => 255,
'#weight' => -1,
'#description' => l(t('What is OpenID?'), 'http://openid.net/', array(
'external' => TRUE,
)),
);
$form['openid.return_to'] = array(
'#type' => 'hidden',
'#value' => url('openid/authenticate', array(
'absolute' => TRUE,
'query' => user_login_destination(),
)),
);
}