You are here

function tmgmt_submit_redirect in Translation Management Tool 8

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

1 string reference to 'tmgmt_submit_redirect'
JobForm::actions in src/Form/JobForm.php
Returns an array of supported actions for the current entity form.

File

./tmgmt.module, line 1138
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']));
  }
}