diff options
author | Alex Pott | 2017-03-14 11:56:20 (GMT) |
---|---|---|
committer | Alex Pott | 2017-03-14 11:56:20 (GMT) |
commit | 7f708faf2fa4955ac6e889889875d9ae4ef42ca0 (patch) | |
tree | 9fcaec317d7b3a9fd4393efb3782bd7ab22a3299 | |
parent | 61b0a38ed241768f2da60052870f86199e4d3278 (diff) |
Issue #2860277 by ritzz, gaurav.kapoor, vaplas: update_language_list() should be removed
-rw-r--r-- | core/includes/update.inc | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/core/includes/update.inc b/core/includes/update.inc index 6e0707f..2caa6ca 100644 --- a/core/includes/update.inc +++ b/core/includes/update.inc @@ -687,78 +687,3 @@ function update_replace_permissions($replace) { ->save(); } } - -/** - * Returns a list of languages set up on the site during upgrades. - * - * @param $flags - * (optional) Specifies the state of the languages that have to be returned. - * It can be: LanguageInterface::STATE_CONFIGURABLE, - * LanguageInterface::STATE_LOCKED, or LanguageInterface::STATE_ALL. - * - * @return \Drupal\Core\Language\LanguageInterface[] - * An associative array of languages, keyed by the language code, ordered by - * weight ascending and name ascending. - */ -function update_language_list($flags = LanguageInterface::STATE_CONFIGURABLE) { - - $languages = &drupal_static(__FUNCTION__); - - // Initialize master language list. - if (!isset($languages)) { - // Initialize local language list cache. - $languages = []; - - // Fill in master language list based on current configuration. - $default = \Drupal::languageManager()->getDefaultLanguage(); - if (\Drupal::languageManager()->isMultilingual() || \Drupal::moduleHandler()->moduleExists('language')) { - // Use language module configuration if available. We can not use - // entity_load_multiple() because this breaks during updates. - $language_entities = \Drupal::configFactory()->listAll('language.entity.'); - - // Initialize default property so callers have an easy reference and can - // save the same object without data loss. - foreach ($language_entities as $langcode_config_name) { - $langcode = substr($langcode_config_name, strlen('language.entity.')); - $info = \Drupal::config($langcode_config_name)->get(); - $languages[$langcode] = new Language([ - 'default' => ($info['id'] == $default->getId()), - 'name' => $info['label'], - 'id' => $info['id'], - 'direction' => $info['direction'], - 'locked' => $info['locked'], - 'weight' => $info['weight'], - ]); - } - Language::sort($languages); - } - else { - // No language module, so use the default language only. - $languages = [$default->getId() => $default]; - // Add the special languages, they will be filtered later if needed. - $languages += \Drupal::languageManager()->getDefaultLockedLanguages($default->getWeight()); - } - } - - // Filter the full list of languages based on the value of the $all flag. By - // default we remove the locked languages, but the caller may request for - // those languages to be added as well. - $filtered_languages = []; - - // Add the site's default language if flagged as allowed value. - if ($flags & LanguageInterface::STATE_SITE_DEFAULT) { - $default = \Drupal::languageManager()->getDefaultLanguage(); - // Rename the default language. - $default->setName(t("Site's default language (@lang_name)", ['@lang_name' => $default->getName()])); - $filtered_languages[LanguageInterface::LANGCODE_SITE_DEFAULT] = $default; - } - - foreach ($languages as $langcode => $language) { - if (($language->isLocked() && !($flags & LanguageInterface::STATE_LOCKED)) || (!$language->isLocked() && !($flags & LanguageInterface::STATE_CONFIGURABLE))) { - continue; - } - $filtered_languages[$langcode] = $language; - } - - return $filtered_languages; -} |