Advertisement
Guest User

Untitled

a guest
Nov 2nd, 2016
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. function customusersubmit_form_alter(&$form, DrupalCoreFormFormStateInterface $form_state, $form_id) {
  2.  
  3. if ($form_id == 'user_login_form') {
  4.  
  5. //code to modify your form input
  6.  
  7. $form['name']['#attributes']['placeholder'] = t('username or emailaddress');
  8. $form['name']['#title'] = 'Username or Email Address';
  9.  
  10. $form['actions']['submit']['#value'] = t('Publish');
  11.  
  12. $form['actions']['submit']['#submit'][] = 'custom_user_submit';
  13. //do something similar to create a custom validation handler
  14. }
  15.  
  16. function custom_user_submit(&$form, DrupalCoreFormFormStateInterface $form_state, $form_id) {
  17.  
  18. if($_GET['op']=='Publish') {
  19.  
  20. drupal_set_message('working user', 'success');
  21.  
  22. $cuser = $form_state->getValue('name');
  23. $cpass = $form_state->getValue('pass');
  24.  
  25. }
  26.  
  27. customusersubmit_user_login('$cuser', '$cpass');
  28.  
  29. print_r(form_state);
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement