Created
June 1, 2018 11:42
-
-
Save v1talii-dev/c377f7ae3dfb1871b9480660e883ce8b to your computer and use it in GitHub Desktop.
D8: redirect after user update
This file contains hidden or 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 mymodule_form_user_form_alter(&$form, FormStateInterface $form_state, $form_id) { | |
if ($form_id === 'user_form') { | |
$form['actions']['submit']['#submit'][] = '__mymodule_form_user_submit'; | |
} | |
} | |
/** | |
* Redirect to /user | |
*/ | |
function __mymodule_form_user_submit(&$form, FormStateInterface $form_state) { | |
$form_state->setRedirect('user.page'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment