function language_test_language_types_info_alter
Same name in other branches
- 8.9.x core/modules/language/tests/language_test/language_test.module \language_test_language_types_info_alter()
- 10 core/modules/language/tests/language_test/language_test.module \language_test_language_types_info_alter()
- 11.x core/modules/language/tests/language_test/language_test.module \language_test_language_types_info_alter()
Implements hook_language_types_info_alter().
File
-
core/
modules/ language/ tests/ language_test/ language_test.module, line 43
Code
function language_test_language_types_info_alter(array &$language_types) {
if (\Drupal::state()->get('language_test.content_language_type')) {
$language_types[LanguageInterface::TYPE_CONTENT]['locked'] = FALSE;
unset($language_types[LanguageInterface::TYPE_CONTENT]['fixed']);
// By default languages are not configurable. Make
// LanguageInterface::TYPE_CONTENT configurable.
$config = \Drupal::configFactory()->getEditable('language.types');
$configurable = $config->get('configurable');
if (!in_array(LanguageInterface::TYPE_CONTENT, $configurable)) {
$configurable[] = LanguageInterface::TYPE_CONTENT;
$config->set('configurable', $configurable)
->save();
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.