Transition form not working on multilingual website

Created on 11 April 2022, about 2 years ago
Updated 14 February 2024, 5 months ago

Problem/Motivation

Transition form not working for multilingual form, it's only appears on the English page, the second language will have an empty form

Steps to reproduce

Add another language to Drupal and create the webform workflow element, send a webform submission and go to the submission page, if you are in the English language you will find the form, change the language to another one and the form will disappear.

πŸ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡―πŸ‡΄Jordan Anas_maw

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • I've tested this on a clean site having added a new language, switching both the user language and the site default language, and can't reproduce the issue. This may have been resolved since the issue was posted. If not please let me know.

  • πŸ‡―πŸ‡΄Jordan Anas_maw

    Hello,
    We still have the problem, it's not solved yet.

  • Status changed to Active over 1 year ago
  • Can you please provide more detail so we can reproduce it? Possibly include screenshots and the webform source YAML if you can. I have done what you have described in the initial issue, with English and French, and it has not had an issue.

  • πŸ‡―πŸ‡΄Jordan Anas_maw

    Could you please try it in the Arabic language? which is right to left language.

  • πŸ‡­πŸ‡ΊHungary gabor.szabolcs

    Hello,
    I have the same issue. I have a multilangual site with a webform. In the base language the webform field works fine, but when I translate the form the webform the element disappears.

    Steps to reproduce:

    1. Create an empty Drupal 9
    2. Install webform_workflows_element and the dependencies
    3. Enable multilingual and a secound language
    4. Create a workflow and translate it
    5. Create a webform with the webform_workflows_element element and link the previously created workflow
    6. Create a translation for the webform
    7. Create a submission in each language

    After these steps in the original language the init state value will be set in the result page, but the translation stays blank.

  • πŸ‡·πŸ‡ΈSerbia botanic_spark

    I have took a quick look and it seams that when on another language $webform->getElementsOriginalDecoded() will return only translations in the elements array, and the condition for finding workflow_element will never work.

    Part where elements are gathered:

    public function getWorkflowElementsForWebform(WebformInterface $webform): array {
        $elements = $webform->getElementsOriginalDecoded();
        return $this->filterWorkflowElements($elements);
      }
    
    protected function filterWorkflowElements(array $elements): array {
        $filtered = [];
        foreach (Element::children($elements) as $key) {
          $element = $elements[$key];
          if (isset($element['#type']) && $element['#type'] == 'webform_workflows_element') {
            $filtered[$key] = $element;
          }
          $filtered += $this->filterWorkflowElements($element);
        }
        return $filtered;
      }
    

    I am not sure if this has additional implications, but if using $webform->getElementsDecoded() instead of $webform->getElementsOriginalDecoded() I get full element structure, so further conditions are working properly.

  • Status changed to Needs review 11 months ago
  • πŸ‡²πŸ‡©Moldova nick.murza Moldova

    after the patch install, i get the site error

  • πŸ‡²πŸ‡©Moldova nick.murza Moldova

    Here is my version for this issue, works for me

  • πŸ‡²πŸ‡©Moldova nick.murza Moldova

    Hmm, so big diff between 1.0.x and 1.0.0 alpha3, this is why cannot apply the patch.

  • πŸ‡²πŸ‡©Moldova nick.murza Moldova

    works for 1.0.0-alpha3

Production build 0.69.0 2024