You are here

function language_configurable_language_insert in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/language/language.module \language_configurable_language_insert()

Implements hook_ENTITY_TYPE_insert() for 'configurable_language'.

File

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

Code

function language_configurable_language_insert(ConfigurableLanguageInterface $language) {
  if ($language
    ->isLocked()) {
    return;
  }

  // Add language to the list of language domains.
  $config = \Drupal::configFactory()
    ->getEditable('language.negotiation');
  $domains = $config
    ->get('url.domains');
  $domains[$language
    ->id()] = '';
  $config
    ->set('url.domains', $domains)
    ->save();
}