Problem/Motivation
Interface language switch links check access to the URL in the target language.
On the content translation 'add' form, access is denied because the entity in the route has been modified with a new translation in \Drupal\content_translation\Controller\ContentTranslationController::add
Steps to reproduce
- Enable 'Content translation' and language modules
- Add another language, for example French: /admin/config/regional/content-language
- Assign 'Language Switcher' block in to a region.
- Create a 'Basic Page' content and visit the 'Add translation' page: /en/node/1/translations/add/en/fr
- Notice no language switch links are available
Proposed resolution
Add the new translation to a clone of the entity, so the entity in the route object is not modified
Remaining tasks
- Write a merge request
- Review
- Commit
User interface changes
Language switch links are available on the 'Add translation' page
API changes
None
Data model changes
None
Release notes snippet
None
Issue fork drupal-3549953
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3549953-missing-language-switch-links
changes, plain diff MR !13390
Comments
Comment #2
idebr commentedComment #3
idebr commentedComment #5
idebr commentedThe merge request updates the ContentTranslationController to add the new translation to a clone of the entity in the route, so access checks for the language switch links pass.
Comment #6
anneke_vde commentedI tested this, I did not have any language switch links before this change. After the change the links are visible.
Comment #7
astonvictor commentedit works for me. thanks
+1 RTBC
Comment #8
catchCommitted/pushed to 11.x and cherry-picked back through to 11.2.x, thanks!