When I want to set the [node:title] of the linked entity in the overlay text for a translatable entity, it always prints the title value of the default language and not the translated value.

Comments

cgoffin created an issue. See original summary.

cgoffin’s picture

I created a patch to fix this issue.

cgoffin’s picture

Added an extra check if we have an empty entity.

markhalliwell’s picture

Version: 8.x-1.3 » 8.x-1.x-dev
Status: Active » Needs review

This looks promising and more like the correct approach. Marking #2977441: Support multilingual for property "overlay text" as a dup of this issue.

The last submitted patch, 2: background_image-token_values_arent_translated-2990856-1.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

markhalliwell’s picture

Status: Needs review » Needs work
+++ b/src/Entity/BackgroundImage.php
@@ -461,6 +461,14 @@ class BackgroundImage extends ContentEntityBase implements BackgroundImageInterf
+      $active_language = \Drupal::languageManager()->getCurrentLanguage()->getId();

The language manager should be wrapped in a static getter method.

p-neyens’s picture

Status: Needs work » Needs review
StatusFileSize
new628 bytes

Use the language manager getter from the class ContentEntityBase.
Added extra check to see if the hasTranslation method exists. Only content entities has this class. @see the ContentEntityBase abstract class. When we add a background image to a webform it breaks at this moment.

markhalliwell’s picture

Assigned: Unassigned » markhalliwell
Status: Needs review » Needs work

Almost there. Just going to clean it up a bit.

markhalliwell’s picture

Assigned: markhalliwell » Unassigned
Status: Needs work » Fixed
StatusFileSize
new2.92 KB

  • markcarver committed 19e4c04 on 8.x-1.x authored by p-neyens
    Issue #2990856 by cgoffin, p-neyens, markcarver: Tokens used in overlay...

Status: Fixed » Closed (fixed)

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