function language_save_default_configuration

Saves a language configuration that is attached to an entity type and bundle.

Parameters

string $entity_type: A string representing the entity type.

string $bundle: A string representing the bundle.

array $values: An array holding the values to be saved having the following keys:

  • langcode: the language code.
  • language_hidden: if the language element should be hidden or not.
4 calls to language_save_default_configuration()
LanguageConfigurationElementTest::testDefaultLangcode in drupal/core/modules/language/lib/Drupal/language/Tests/LanguageConfigurationElementTest.php
Tests that the language_get_default_langcode() returns the correct values.
language_configuration_element_submit in drupal/core/modules/language/language.module
Submit handler for the forms that have a language_configuration element.
language_node_type_update in drupal/core/modules/language/language.module
Implements hook_node_type_update().
LocaleUninstallTest::testUninstallProcess in drupal/core/modules/locale/lib/Drupal/locale/Tests/LocaleUninstallTest.php
Check if the values of the Locale variables are correct after uninstall.

File

drupal/core/modules/language/language.module, line 334
Add language handling functionality to Drupal.

Code

function language_save_default_configuration($entity_type, $bundle, $values = array()) {
  config('language.settings')
    ->set(language_get_default_configuration_settings_key($entity_type, $bundle), array(
    'langcode' => $values['langcode'],
    'language_hidden' => $values['language_hidden'],
  ))
    ->save();
}