LingotekNodeTranslatableParagraphsAsymmetricTranslationTest.php in Lingotek Translation 3.5.x
Same filename in this branch
Same filename and directory in other branches
- 8.2 tests/src/Functional/LingotekNodeTranslatableParagraphsAsymmetricTranslationTest.php
- 4.0.x tests/src/Functional/LingotekNodeTranslatableParagraphsAsymmetricTranslationTest.php
- 3.1.x tests/src/Functional/LingotekNodeTranslatableParagraphsAsymmetricTranslationTest.php
- 3.2.x tests/src/Functional/LingotekNodeTranslatableParagraphsAsymmetricTranslationTest.php
- 3.3.x tests/src/Functional/LingotekNodeTranslatableParagraphsAsymmetricTranslationTest.php
- 3.4.x tests/src/Functional/LingotekNodeTranslatableParagraphsAsymmetricTranslationTest.php
- 3.6.x tests/src/Functional/LingotekNodeTranslatableParagraphsAsymmetricTranslationTest.php
- 3.7.x tests/src/Functional/LingotekNodeTranslatableParagraphsAsymmetricTranslationTest.php
- 3.8.x tests/src/Functional/LingotekNodeTranslatableParagraphsAsymmetricTranslationTest.php
Namespace
Drupal\Tests\lingotek\FunctionalFile
tests/src/Functional/LingotekNodeTranslatableParagraphsAsymmetricTranslationTest.phpView source
<?php
namespace Drupal\Tests\lingotek\Functional;
use Drupal\Core\Entity\Entity\EntityFormDisplay;
/**
* Tests translating a node with multiple locales including translatable paragraphs.
*
* @group lingotek
* @group legacy
*/
class LingotekNodeTranslatableParagraphsAsymmetricTranslationTest extends LingotekNodeTranslatableParagraphsTranslationTest {
/**
* {@inheritdoc}
*/
public static $modules = [
'paragraphs_asymmetric_translation_widgets',
];
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
$this
->setFormDisplaysToAsymmetric();
}
protected function setFormDisplaysToAsymmetric() : void {
/** @var \Drupal\Core\Entity\Display\EntityFormDisplayInterface[] $formDisplays */
$formDisplays = EntityFormDisplay::loadMultiple();
foreach ($formDisplays as $formDisplay) {
$components = $formDisplay
->getComponents();
$toSave = FALSE;
foreach ($components as $id => $component) {
if (isset($component['type']) && $component['type'] === 'entity_reference_paragraphs') {
$component['type'] = 'paragraphs_classic_asymmetric';
$formDisplay
->setComponent($id, $component);
$toSave = TRUE;
}
}
if ($toSave) {
$formDisplay
->save();
}
}
}
}
Classes
Name | Description |
---|---|
LingotekNodeTranslatableParagraphsAsymmetricTranslationTest | Tests translating a node with multiple locales including translatable paragraphs. |