function LayoutBuilderTranslationTest::addEntityTranslation
Adds an entity translation.
2 calls to LayoutBuilderTranslationTest::addEntityTranslation()
- LayoutBuilderTranslationTest::testLayoutOverrideBeforeTranslation in core/modules/ layout_builder/ tests/ src/ Functional/ LayoutBuilderTranslationTest.php 
- Tests that layout overrides work when created before a translation.
- LayoutBuilderTranslationTest::testTranslationBeforeLayoutOverride in core/modules/ layout_builder/ tests/ src/ Functional/ LayoutBuilderTranslationTest.php 
- Tests that layout overrides work when created after a translation.
File
- 
              core/modules/ layout_builder/ tests/ src/ Functional/ LayoutBuilderTranslationTest.php, line 176 
Class
- LayoutBuilderTranslationTest
- Tests that the Layout Builder works with translated content.
Namespace
Drupal\Tests\layout_builder\FunctionalCode
protected function addEntityTranslation() {
  $user = $this->loggedInUser;
  $this->drupalLogin($this->translator);
  $add_translation_url = Url::fromRoute("entity.{$this->entityTypeId}.content_translation_add", [
    $this->entityTypeId => $this->entity
      ->id(),
    'source' => $this->langcodes[0],
    'target' => $this->langcodes[2],
  ]);
  $this->drupalGet($add_translation_url);
  $this->submitForm([
    "{$this->fieldName}[0][value]" => 'The translated field value',
  ], 'Save');
  $this->drupalLogin($user);
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
