You are here

function language_configurable_language_delete in Zircon Profile 8

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

Implements hook_ENTITY_TYPE_delete() for 'configurable_language'.

File

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

Code

function language_configurable_language_delete(ConfigurableLanguageInterface $language) {

  // Remove language from language prefix list.
  $config = \Drupal::configFactory()
    ->getEditable('language.negotiation');
  $prefixes = $config
    ->get('url.prefixes');
  unset($prefixes[$language
    ->id()]);
  $config
    ->set('url.prefixes', $prefixes)
    ->save();

  // Remove language from language domain list.
  $config = \Drupal::configFactory()
    ->getEditable('language.negotiation');
  $domains = $config
    ->get('url.domains');
  unset($domains[$language
    ->id()]);
  $config
    ->set('url.domains', $domains)
    ->save();
}