Problem/Motivation

If you use the thumbnail formatter for a media item and use the option »Link image to« to link to the entity or the media item itself, the link always point to the original language of the entity or the media item. In a multilingual environment the user is loosing the current language by clicking on the link.

Proposed resolution

I adapt the provided solution on 2798977 to the MediaThumbnailFormatter to consider current content language.

Remaining tasks

It would be nice to merge all kind of related issues and provide a fix in one of next releases.

Comments

rwam created an issue. See original summary.

rwam’s picture

Status: Active » Needs review
StatusFileSize
new4.12 KB
borisson_’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

We should add a test similar to the one added in #2798977: Wrong language handling in ImageFormatter when linking to entity as well.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

chr.fritsch’s picture

Issue tags: +DrupalEurope

Adding the #DrupalEurope tag for the Friday contribution sprint

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

enrocean167’s picture

I don't know what is the better approach, but here is a patch with the same solution as in https://www.drupal.org/project/drupal/issues/2645922

ankithashetty’s picture

Status: Needs work » Needs review
StatusFileSize
new1.59 KB
new805 bytes

Just fixed the custom commands failure in #9, thanks!

agoradesign’s picture

#10 works for me (tried with 9.1.7)

quietone’s picture

Status: Needs review » Needs work

Setting NW for tests.

agoradesign’s picture

added #3089216: Media Thumbnail Formatter doesn't translate the title attribute correctly as related issue, as it also deals with translation problems on this formatter plugin

naresh_bavaskar’s picture

Assigned: Unassigned » naresh_bavaskar
naresh_bavaskar’s picture

Assigned: naresh_bavaskar » Unassigned
Status: Needs work » Needs review
StatusFileSize
new4.9 KB
new3.15 KB

Added Tests, Please review.... (Initial test case might need some changes)

ajv009’s picture

Status: Needs review » Reviewed & tested by the community

Thanks @naresh_bavaskar for the tests. LGTM
Applies without any problem on 8.9.x
But someone with a better experience in writing tests for core should take a final look :)

naresh_bavaskar’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new3.31 KB

Failed PHPUnit test cases - testing

naresh_bavaskar’s picture

Status: Needs review » Needs work

Something goes wrong while running Functional test cases, The Problem described in the ticket description its not able to reproducing on chromedriver testcases.

while phpunit browser output without fixing issue:
fr/node/{node_id} instead of /node/{node_id}

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

rwam’s picture

Changes in https://www.drupal.org/project/drupal/issues/3255887 break the initial patch after updating our site to Drupal 9.5.0 so I've adapted the solution from #17 which work well on 9.5.x. I'm not familiar with testing so feel free to contribute or update the tests.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

proweb.ua’s picture

#23 work.
Drupal 10.3.6

atul_ghate’s picture

I am not able to reproduce this issue on Drupal 11.x. The steps I followed to reproduce are as below:

1.Clone Drupal 11.x and enable the Language and Content Translation modules.
2.Change the Manage Display settings for the media type and select the Thumbnail formatter with the Link to entity option enabled.
3.Create a Media type (image) and enable translation for it. Add an image with an English translation, then add a translation for another
language for the same media image
4.Add this media image to an Article node.
5.When I click on the image, it redirects me to the correct language version of the node.
Please let me know if there is anything I am missing.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.