function ContentTranslationTestTrait::enableContentTranslation
Enables content translation for the given entity type bundle.
Parameters
string $entity_type_id: The ID of the entity type.
string $bundle: The bundle name.
string|null $default_langcode: The language code to use as the default language.
16 calls to ContentTranslationTestTrait::enableContentTranslation()
- ContentTranslationContextualLinksTest::testContentTranslationContextualLinks in core/
modules/ content_translation/ tests/ src/ Functional/ ContentTranslationContextualLinksTest.php  - Tests that a contextual link is available for translating a node.
 - ContentTranslationLanguageChangeTest::setUp in core/
modules/ content_translation/ tests/ src/ Functional/ ContentTranslationLanguageChangeTest.php  - DisplayFeedTranslationTest::setUp in core/
modules/ views/ tests/ src/ Functional/ Plugin/ DisplayFeedTranslationTest.php  - Sets up the test.
 - EntityReferenceFieldTranslatedReferenceViewTest::enableTranslation in core/
modules/ field/ tests/ src/ Functional/ EntityReference/ EntityReferenceFieldTranslatedReferenceViewTest.php  - Enables translations where it needed.
 - FileOnTranslatedEntityTest::setUp in core/
modules/ file/ tests/ src/ Functional/ FileOnTranslatedEntityTest.php  
File
- 
              core/
modules/ content_translation/ tests/ src/ Traits/ ContentTranslationTestTrait.php, line 27  
Class
- ContentTranslationTestTrait
 - Provides an API to programmatically manage content translation in tests.
 
Namespace
Drupal\Tests\content_translation\TraitsCode
public function enableContentTranslation(string $entity_type_id, string $bundle, ?string $default_langcode = LanguageInterface::LANGCODE_SITE_DEFAULT) : void {
  static::enableBundleTranslation($entity_type_id, $bundle, $default_langcode);
  $content_translation_manager = $this->container
    ->get('content_translation.manager');
  $content_translation_manager->setEnabled($entity_type_id, $bundle, TRUE);
  $content_translation_manager->setBundleTranslationSettings($entity_type_id, $bundle, [
    'untranslatable_fields_hide' => FALSE,
  ]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.