function tmgmt_submit_redirect

Helper function for redirecting a form after a button has been clicked.

1 string reference to 'tmgmt_submit_redirect'

File

./tmgmt.module, line 1144
Main module file for the Translation Management module.

Code

function tmgmt_submit_redirect(array $form, FormStateInterface $form_state) {

  // Remove destination from the query to fix form redirects.
  \Drupal::request()->query
    ->remove('destination');
  if ($form_state
    ->getTriggeringElement()['#redirect']) {
    $form_state
      ->setRedirectUrl(Url::fromUri('base:' . $form_state
      ->getTriggeringElement()['#redirect']));
  }
}