The existing preview code in EmbedController doesn't pass current language to filters, so it's not possible to show the embedded content according to the current language. For example, if translatable media is embedded, the matching media translation is shown when the container entity is viewed, but not when it's edited. I suggest to add langcode parameter to the render array in EmbedController::preview().

Comments

maximpodorov created an issue. See original summary.

maximpodorov’s picture

StatusFileSize
new491 bytes
maximpodorov’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 2: embed-preview_language-3000871-2.patch, failed testing. View results

dave reid’s picture

Status: Needs work » Needs review
maximpodorov’s picture

StatusFileSize
new859 bytes

BTW, the content language should be selected here instead of the interface language. The patch is updated.

dave reid’s picture

Status: Needs review » Fixed

Tested and committed #6 to 8.x-1.x. Thanks!

maximpodorov’s picture

This line was lost: use Drupal\Core\Language\LanguageInterface;
Oh, it was added by previous commits.

dave reid’s picture

I was using git add -p and I made sure it made it in a following commit before I tagged the 8.x-1.2 release.

Status: Fixed » Closed (fixed)

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