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

  1. Enable 'Content translation' and language modules
  2. Add another language, for example French: /admin/config/regional/content-language
  3. Assign 'Language Switcher' block in to a region.
  4. Create a 'Basic Page' content and visit the 'Add translation' page: /en/node/1/translations/add/en/fr
  5. 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

  1. Write a merge request
  2. Review
  3. 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

Command icon 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:

Comments

idebr created an issue. See original summary.

idebr’s picture

Issue summary: View changes
idebr’s picture

Issue summary: View changes

idebr’s picture

Status: Active » Needs review

The 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.

anneke_vde’s picture

Status: Needs review » Reviewed & tested by the community

I tested this, I did not have any language switch links before this change. After the change the links are visible.

astonvictor’s picture

it works for me. thanks
+1 RTBC

catch’s picture

Version: 11.x-dev » 11.2.x-dev
Status: Reviewed & tested by the community » Fixed

Committed/pushed to 11.x and cherry-picked back through to 11.2.x, thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • catch committed 034eaaff on 11.2.x
    Issue #3549953 by idebr: No interface language switch links available on...

  • catch committed 24bcada2 on 11.x
    Issue #3549953 by idebr: No interface language switch links available on...

  • catch committed af256fc2 on 11.3.x
    Issue #3549953 by idebr: No interface language switch links available on...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.