Skip to content

Instantly share code, notes, and snippets.

@kedramon
Created July 20, 2017 14:39
Show Gist options
  • Save kedramon/9d594aabfe37d2d7a1a906210c03bf87 to your computer and use it in GitHub Desktop.
Save kedramon/9d594aabfe37d2d7a1a906210c03bf87 to your computer and use it in GitHub Desktop.
Redirect user after register form submit to internal page.
/**
* Implements hook_form_BASE_FORM_ID_alter().
*/
function ns_user_form_user_register_form_alter(&$form, FormStateInterface $form_state, $form_id) {
$form['actions']['submit']['#value'] = t('Send');
$form['#attached']['library'][] = 'core/jquery.ui.tooltip';
$form['#attached']['library'][] = 'nedapsecurity/tooltips';
$form['actions']['submit']['#submit'][] = 'ns_user_register_submit_handler';
}
/**
* Custom submit handler.
*/
function ns_user_register_submit_handler(&$form, FormStateInterface $form_state) {
$url = Url::fromUri('internal:/thank-you');
$form_state->setRedirectUrl($url);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment