language_configurable_language_delete

language_configurable_language_delete(ConfigurableLanguageInterface $language)

Implements hook_ENTITY_TYPE_delete() for 'configurable_language'.

File

core/modules/language/language.module, line 363
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();
}
doc_Drupal
2016-10-29 09:23:00
Comments
Leave a Comment

Please login to continue.