Last active
June 13, 2017 19:42
-
-
Save brooke-heaton/124c61f6720d5c3e0ce837a9948245e9 to your computer and use it in GitHub Desktop.
D8 Redirect on registration form
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
<?php | |
/** | |
* Implements hook_form_FORM_ID_alter(). | |
*/ | |
function capitalcamp_glue_form_user_register_form_alter(&$form, FormStateInterface $form_state, $form_id) { | |
// @todo come up with a more elegant approach here. | |
// Alter login form and add own custom submit handler. | |
$form['actions']['submit']['#submit'][] = '_capitalcamp_glue_user_register_form_submit'; | |
} | |
/** | |
* Custom submit handler for registration form. | |
*/ | |
function _capitalcamp_glue_user_register_form_submit($form, FormStateInterface $form_state) { | |
// Set redirect to login form. | |
$url = Url::fromUri('internal:/form/registration'); | |
$form_state->setRedirectUrl($url); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment