Advertisement
Guest User

Untitled

a guest
Aug 28th, 2015
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. function openid_form_user_login_alter(&$form, &$form_state) {
  2. _openid_user_login_form_alter($form, $form_state);
  3. }
  4.  
  5. function openid_form_user_login_block_alter(&$form, &$form_state) {
  6. _openid_user_login_form_alter($form, $form_state);
  7. }
  8.  
  9. function _openid_user_login_form_alter(&$form, &$form_state) {
  10. $form ['#attached']['css'][] = drupal_get_path('module', 'openid') . '/openid.css';
  11. $form ['#attached']['js'][] = drupal_get_path('module', 'openid') . '/openid.js';
  12. $form ['#attached']['library'][] = array('system', 'jquery.cookie');
  13. if (!empty($form_state ['input']['openid_identifier'])) {
  14. $form ['name']['#required'] = FALSE;
  15. $form ['pass']['#required'] = FALSE;
  16. unset($form ['#submit']);
  17. $form ['#validate'] = array('openid_login_validate');
  18. }
  19.  
  20. $items = array();
  21. $items [] = array(
  22. 'data' => l(t('Log in using OpenID'), '#openid-login', array('external' => TRUE)),
  23. 'class' => array('openid-link'),
  24. );
  25. $items [] = array(
  26. 'data' => l(t('Cancel OpenID login'), '#', array('external' => TRUE)),
  27. 'class' => array('user-link'),
  28. );
  29.  
  30. $form ['openid_links'] = array(
  31. '#theme' => 'item_list',
  32. '#items' => $items,
  33. '#attributes' => array('class' => array('openid-links')),
  34. '#weight' => 1,
  35. );
  36.  
  37. $form ['links']['#weight'] = 2;
  38.  
  39. $form ['openid_identifier'] = array(
  40. '#type' => 'textfield',
  41. '#title' => t('Log in using OpenID'),
  42. '#size' => $form ['name']['#size'],
  43. '#maxlength' => 255,
  44. '#weight' => -1,
  45. '#description' => l(t('What is OpenID?'), 'http://openid.net/', array('external' => TRUE)),
  46. );
  47. $form ['openid.return_to'] = array('#type' => 'hidden', '#value' => url('openid/authenticate', array('absolute' => TRUE, 'query' => user_login_destination())));
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement