You are here

protected function LingotekNodeTranslatableParagraphsAsymmetricTranslationTest::setFormDisplaysToAsymmetric in Lingotek Translation 3.6.x

Same name in this branch
  1. 3.6.x tests/src/Functional/LingotekNodeTranslatableParagraphsAsymmetricTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeTranslatableParagraphsAsymmetricTranslationTest::setFormDisplaysToAsymmetric()
  2. 3.6.x tests/src/FunctionalJavascript/LingotekNodeTranslatableParagraphsAsymmetricTranslationTest.php \Drupal\Tests\lingotek\FunctionalJavascript\LingotekNodeTranslatableParagraphsAsymmetricTranslationTest::setFormDisplaysToAsymmetric()
Same name and namespace in other branches
  1. 8.2 tests/src/Functional/LingotekNodeTranslatableParagraphsAsymmetricTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeTranslatableParagraphsAsymmetricTranslationTest::setFormDisplaysToAsymmetric()
  2. 4.0.x tests/src/Functional/LingotekNodeTranslatableParagraphsAsymmetricTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeTranslatableParagraphsAsymmetricTranslationTest::setFormDisplaysToAsymmetric()
  3. 3.1.x tests/src/Functional/LingotekNodeTranslatableParagraphsAsymmetricTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeTranslatableParagraphsAsymmetricTranslationTest::setFormDisplaysToAsymmetric()
  4. 3.2.x tests/src/Functional/LingotekNodeTranslatableParagraphsAsymmetricTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeTranslatableParagraphsAsymmetricTranslationTest::setFormDisplaysToAsymmetric()
  5. 3.3.x tests/src/Functional/LingotekNodeTranslatableParagraphsAsymmetricTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeTranslatableParagraphsAsymmetricTranslationTest::setFormDisplaysToAsymmetric()
  6. 3.4.x tests/src/Functional/LingotekNodeTranslatableParagraphsAsymmetricTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeTranslatableParagraphsAsymmetricTranslationTest::setFormDisplaysToAsymmetric()
  7. 3.5.x tests/src/Functional/LingotekNodeTranslatableParagraphsAsymmetricTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeTranslatableParagraphsAsymmetricTranslationTest::setFormDisplaysToAsymmetric()
  8. 3.7.x tests/src/Functional/LingotekNodeTranslatableParagraphsAsymmetricTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeTranslatableParagraphsAsymmetricTranslationTest::setFormDisplaysToAsymmetric()
  9. 3.8.x tests/src/Functional/LingotekNodeTranslatableParagraphsAsymmetricTranslationTest.php \Drupal\Tests\lingotek\Functional\LingotekNodeTranslatableParagraphsAsymmetricTranslationTest::setFormDisplaysToAsymmetric()
1 call to LingotekNodeTranslatableParagraphsAsymmetricTranslationTest::setFormDisplaysToAsymmetric()
LingotekNodeTranslatableParagraphsAsymmetricTranslationTest::setUp in tests/src/Functional/LingotekNodeTranslatableParagraphsAsymmetricTranslationTest.php

File

tests/src/Functional/LingotekNodeTranslatableParagraphsAsymmetricTranslationTest.php, line 28

Class

LingotekNodeTranslatableParagraphsAsymmetricTranslationTest
Tests translating a node with multiple locales including translatable paragraphs.

Namespace

Drupal\Tests\lingotek\Functional

Code

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();
    }
  }
}