Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong iFrame preview URL when viewing Latest version of a draft of a translation #500

Open
marcorcau opened this issue May 23, 2023 · 1 comment · May be fixed by #501
Open

Wrong iFrame preview URL when viewing Latest version of a draft of a translation #500

marcorcau opened this issue May 23, 2023 · 1 comment · May be fixed by #501

Comments

@marcorcau
Copy link

Description

In a multi-language setup with workflow enabled and draft status, the iFrame preview URL is correctly calculated for all links in "Revisions" tab, which follow the URL structure: /[langcode]/node/[nid]/revisions/[vid]/view.

But the iFrame URL is wrong for drafts not in the node original language when visiting the "Latest revision" tab. URL in this case has the structure: /[langcode]/node/[nid]/latest.

In this case, the latest revision of the entity in its original language is displayed.

The following screenshot demonstrates the URL language in the browser is "de-ch" but the URL in the iFrame is "de":

imatge

In my screenshot in the preview frame an error appears, but that might be related to my setup. The important part is wrong langcode in the URL.

Steps to reproduce

In a basic Next.js 1.6.3 setup on Drupal 10

  • Enable language and workflow. Set multiple languages with URL detection method and workflow with Draft and Published statuses, and transitions between both of them.
  • Create a node in "Language 1".
  • Translate to "Language 2" and publish.
  • Edit again in "Language 2" and save as draft.
  • Click "Revisions" on translation and preview the first in the list -> Correct content will appear.
  • Click "Latest revision" -> The content in "Language 1" will appear.
  • Inspect frame URL -> The slug URL parameter contains language 1 langcode, not language 2.
marcorcau pushed a commit to marcorcau/next-drupal that referenced this issue May 23, 2023
@apmsooner
Copy link
Contributor

This line is currently returning the node in the default language: https://github.com/chapter-three/next-drupal/blob/main/modules/next/src/NextEntityTypeManager.php#L80

It appears that commenting that out and just returning $parameter in line 85 loads the revision for the translated language correctly. I don't know if this is always the case or based on my current language detection settings. I can provide a patch for this if this is the right course of action... just not 100% sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants