// file modules/custom/mymodule/mymodule.module /** * Implements hook_form_alter(). */ function henka_training_form_alter(&$form, FormStateInterface $form_state, $form_id) { if ($form_id == 'user_login_form') { $form['#submit'][] = 'redirect_submit_handler'; } } /** * Custom submit handler for login form. */ function redirect_submit_handler($form, FormStateInterface $form_state) { $url = Url::fromUri('internal:/formacion'); // or $url = Url::fromRoute('view.VIEW_MACHINE_NAME.PAGE_MACHINENAME'); //example $url = Url::fromRoute('view.henka_training.page_training'); $form_state->setRedirectUrl($url); }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter