Mercurial > hg > cmmr2012-drupal-site
comparison core/modules/language/src/LanguageNegotiator.php @ 5:12f9dff5fda9 tip
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:34:47 +0100 |
parents | c75dbcec494b |
children |
comparison
equal
deleted
inserted
replaced
4:a9cd425dd02b | 5:12f9dff5fda9 |
---|---|
248 public function saveConfiguration($type, $enabled_methods) { | 248 public function saveConfiguration($type, $enabled_methods) { |
249 // As configurable language types might have changed, we reset the cache. | 249 // As configurable language types might have changed, we reset the cache. |
250 $this->languageManager->reset(); | 250 $this->languageManager->reset(); |
251 $definitions = $this->getNegotiationMethods(); | 251 $definitions = $this->getNegotiationMethods(); |
252 $default_types = $this->languageManager->getLanguageTypes(); | 252 $default_types = $this->languageManager->getLanguageTypes(); |
253 | |
254 // Ensure that the weights are integers. | |
255 $enabled_methods = array_map('intval', $enabled_methods); | |
253 | 256 |
254 // Order the language negotiation method list by weight. | 257 // Order the language negotiation method list by weight. |
255 asort($enabled_methods); | 258 asort($enabled_methods); |
256 foreach ($enabled_methods as $method_id => $weight) { | 259 foreach ($enabled_methods as $method_id => $weight) { |
257 if (isset($definitions[$method_id])) { | 260 if (isset($definitions[$method_id])) { |
266 } | 269 } |
267 else { | 270 else { |
268 unset($enabled_methods[$method_id]); | 271 unset($enabled_methods[$method_id]); |
269 } | 272 } |
270 } | 273 } |
271 $this->configFactory->getEditable('language.types')->set('negotiation.' . $type . '.enabled', $enabled_methods)->save(); | 274 $this->configFactory->getEditable('language.types')->set('negotiation.' . $type . '.enabled', $enabled_methods)->save(TRUE); |
272 } | 275 } |
273 | 276 |
274 /** | 277 /** |
275 * {@inheritdoc} | 278 * {@inheritdoc} |
276 */ | 279 */ |