- Issue created by @marvil07
Usually, language configuration is saved through the form at admin/config/regional/content-language
, that includes options for each translatable entity bundle.
From there Drupal\language\Form\ContentLanguageSettingsForm
submit handler is called, and a save over the related Drupal\language\Entity\ContentLanguageSettings
object is performed.
In the context of 📌 Use the API to set up languages in tests that are not specifically testing the language form Fixed , a new trait is added to help with the specific action of disabling translation for a given bundle.
In that trait, the action of saving the related ContentLanguageSettings
seems to not be enough to effectively disable a given bundle translation.
Instead it is also needed to delete that configuration entity.
In a code snippet:
<?php
// 1. The following two statements are not enough to disable it.
$content_language_settings = ContentLanguageSettings::loadByEntityTypeBundle($entity_type_id, $bundle);
$content_language_settings->setLanguageAlterable(FALSE)
->save();
// 2. Instead, deleting the configuration entity is also needed.
$content_language_settings->delete();
Suggestions are welcome.
Active
11.0 🔥