Wrong destination when editing the original language translation

Created on 29 October 2024, 18 days ago

Problem/Motivation

The ?destination param is wrong and causes a 404 on form submission when editing the original language translation of a webform.

Steps to reproduce

  • Install and configure the translation on a site
  • Go the translation page of a webform /admin/structure/webform/manage/{webform}/translate
  • Click on the Edit link of the original language, the url will be like en/admin/structure/webform/manage/{webform}?destination=admin/structure/webform/manage/{webform}/translate
  • Save the webform, the page will redirect to 404
๐Ÿ› Bug report
Status

Active

Version

6.2

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡นItaly Giuseppe87

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Giuseppe87
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia abhishek@kumar

    If the Webform module doesnโ€™t handle the destination properly, you could override the destination parameter temporarily in a custom module or by using hook_form_alter:

    function custom_module_form_webform_edit_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
      if (\Drupal::routeMatch()->getRouteName() == 'entity.webform.canonical') {
        $form['#action'] = '/admin/structure/webform/manage/' . $form['#webform']->id() . '/translate';
      }
    }
    
Production build 0.71.5 2024