function MediaEmbedFilterTranslationTest::providerTranslationSituations
Same name in other branches
- 9 core/modules/media/tests/src/Kernel/MediaEmbedFilterTranslationTest.php \Drupal\Tests\media\Kernel\MediaEmbedFilterTranslationTest::providerTranslationSituations()
- 8.9.x core/modules/media/tests/src/Kernel/MediaEmbedFilterTranslationTest.php \Drupal\Tests\media\Kernel\MediaEmbedFilterTranslationTest::providerTranslationSituations()
- 11.x core/modules/media/tests/src/Kernel/MediaEmbedFilterTranslationTest.php \Drupal\Tests\media\Kernel\MediaEmbedFilterTranslationTest::providerTranslationSituations()
Data provider for testTranslationSelection().
File
-
core/
modules/ media/ tests/ src/ Kernel/ MediaEmbedFilterTranslationTest.php, line 73
Class
- MediaEmbedFilterTranslationTest
- Tests that media embeds are translated based on text (host entity) language.
Namespace
Drupal\Tests\media\KernelCode
public static function providerTranslationSituations() {
$embedded_entity_translation_languages = [
'en',
'pt-br',
];
foreach ([
'en',
'pt-br',
'nl',
] as $text_langcode) {
// The text language (which is set to the host entity's language) must be
// respected in selecting a translation. If that translation does not
// exist, it falls back to the default translation of the embedded entity.
$match_or_fallback_langcode = in_array($text_langcode, $embedded_entity_translation_languages) ? $text_langcode : 'en';
(yield "text_langcode={$text_langcode} ⇒ {$match_or_fallback_langcode}" => [
$text_langcode,
$match_or_fallback_langcode,
]);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.