comparison core/modules/language/src/Entity/ConfigurableLanguage.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 4c8ae668cc8c
children af1871eacc83
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
14 * Defines the ConfigurableLanguage entity. 14 * Defines the ConfigurableLanguage entity.
15 * 15 *
16 * @ConfigEntityType( 16 * @ConfigEntityType(
17 * id = "configurable_language", 17 * id = "configurable_language",
18 * label = @Translation("Language"), 18 * label = @Translation("Language"),
19 * label_collection = @Translation("Languages"),
20 * label_singular = @Translation("language"),
21 * label_plural = @Translation("languages"),
22 * label_count = @PluralTranslation(
23 * singular = "@count language",
24 * plural = "@count languages",
25 * ),
19 * handlers = { 26 * handlers = {
20 * "list_builder" = "Drupal\language\LanguageListBuilder", 27 * "list_builder" = "Drupal\language\LanguageListBuilder",
21 * "access" = "Drupal\language\LanguageAccessControlHandler", 28 * "access" = "Drupal\language\LanguageAccessControlHandler",
22 * "form" = { 29 * "form" = {
23 * "add" = "Drupal\language\Form\LanguageAddForm", 30 * "add" = "Drupal\language\Form\LanguageAddForm",
137 } 144 }
138 if (!$update) { 145 if (!$update) {
139 // Install any available language configuration overrides for the language. 146 // Install any available language configuration overrides for the language.
140 \Drupal::service('language.config_factory_override')->installLanguageOverrides($this->id()); 147 \Drupal::service('language.config_factory_override')->installLanguageOverrides($this->id());
141 } 148 }
149
150 if (!$this->isLocked() && !$update) {
151 // Add language to the list of language domains.
152 $config = \Drupal::configFactory()->getEditable('language.negotiation');
153 $domains = $config->get('url.domains');
154 $domains[$this->id()] = '';
155 $config->set('url.domains', $domains)->save();
156 }
142 } 157 }
143 158
144 /** 159 /**
145 * {@inheritdoc} 160 * {@inheritdoc}
146 * 161 *
171 // If after deleting this language the site will become monolingual, we need 186 // If after deleting this language the site will become monolingual, we need
172 // to rebuild language services. 187 // to rebuild language services.
173 if (!\Drupal::languageManager()->isMultilingual()) { 188 if (!\Drupal::languageManager()->isMultilingual()) {
174 ConfigurableLanguageManager::rebuildServices(); 189 ConfigurableLanguageManager::rebuildServices();
175 } 190 }
191
192 // Remove language from language prefix and domain list.
193 $config = \Drupal::configFactory()->getEditable('language.negotiation');
194 $config->clear('url.prefixes.' . $entity->id());
195 $config->clear('url.domains.' . $entity->id());
196 $config->save();
176 } 197 }
177 198
178 /** 199 /**
179 * Gets the default langcode. 200 * Gets the default langcode.
180 * 201 *