Last active
January 10, 2019 19:12
-
-
Save asipple1/ead0021e3a13f082bcc68a95885665ff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Drupal\Core\Form\FormStateInterface; | |
function hook_form_alter(&$form, FormStateInterface $form_state, $form_id) { | |
switch ($form_id) { | |
// Alter login form and add own custom submit handler. | |
case 'user_login_form': | |
$form['#submit'][] = '_statefair_user_login_form_submit'; | |
break; | |
} | |
} | |
/** | |
* Custom submit handler for login form. | |
*/ | |
function _user_login_form_submit($form, FormStateInterface $form_state) { | |
// Set redirect to login form. | |
$form_state->setRedirect('<front>'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment