Found in #2486177-94: Deleting an entity translation from the UI deletes the whole entity.

Problem/Motivation

Contextual links do not take language into account, thus they stored in the client's local storage once and for all regardless of the site language and possibly the target content language.

Proposed resolution

Always pass the URL language as metadata to build language-aware ids.

Remaining tasks

  • Validate the solution
  • Write a patch
  • Review it

User interface changes

None

API changes

None

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

plach’s picture

Title: Contextual links broken on multilingual sites » Contextual links are broken on multilingual sites
Assigned: Unassigned » plach
Related issues: +#2486177: Deleting an entity translation from the UI deletes the whole entity

Working on this

plach’s picture

Assigned: plach » Unassigned
Status: Active » Needs review
FileSize
5.8 KB
8.16 KB

Let's try this

The last submitted patch, 2: contextual-multilingual-2488940-2-test.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 2: contextual-multilingual-2488940-2.patch, failed testing.

plach’s picture

Status: Needs work » Needs review
FileSize
10.12 KB

This should be better

plach’s picture

Issue summary: View changes
dawehner’s picture

+++ b/core/modules/contextual/contextual.module
@@ -155,9 +156,14 @@ function contextual_contextual_links_view_alter(&$element, $items) {
+    if (!isset($args['metadata'])) {
+      $args['metadata'] = [];
+    }
+    $args['metadata'] += ['langcode' => $langcode];

What about using $args += ['metadata' => []]; and $args['metadata'] += ['langcode' => $langcode];

plach’s picture

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

This looks perfect for me

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

This issue addresses a major bug and is allowed per https://www.drupal.org/core/beta-changes. Committed 0b1a9a3 and pushed to 8.0.x. Thanks!

  • alexpott committed 0b1a9a3 on 8.0.x
    Issue #2488940 by plach: Contextual links are broken on multilingual...
Gábor Hojtsy’s picture

Issue tags: -sprint

Yay, thanks!

Status: Fixed » Closed (fixed)

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