function LanguageTestTrait::disableBundleTranslation

Same name in other branches
  1. 11.x core/modules/language/tests/src/Traits/LanguageTestTrait.php \Drupal\Tests\language\Traits\LanguageTestTrait::disableBundleTranslation()

Disables translations for the given entity type bundle.

Parameters

string $entity_type_id: The ID of the entity type.

string $bundle: The bundle name.

2 calls to LanguageTestTrait::disableBundleTranslation()
ContentTranslationOperationsTest::testOperationTranslateLink in core/modules/content_translation/tests/src/Functional/ContentTranslationOperationsTest.php
Tests that the operation "Translate" is displayed in the content listing.
EntityReferenceFieldTranslatedReferenceViewTest::testEntityReferenceDisplay in core/modules/field/tests/src/Functional/EntityReference/EntityReferenceFieldTranslatedReferenceViewTest.php
Tests if the entity is displayed in an entity reference field.

File

core/modules/language/tests/src/Traits/LanguageTestTrait.php, line 65

Class

LanguageTestTrait
Provides an API to programmatically manage languages in tests.

Namespace

Drupal\Tests\language\Traits

Code

public static function disableBundleTranslation(string $entity_type_id, string $bundle) {
    // @todo Move to API call when it exists, to be added at
    // https://www.drupal.org/project/drupal/issues/3408046
    $content_language_settings = ContentLanguageSettings::loadByEntityTypeBundle($entity_type_id, $bundle);
    $content_language_settings->setLanguageAlterable(FALSE)
        ->save();
    $content_language_settings->delete();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.