Skip to content
This repository
Browse code

Using Config API to retrieve core values (fixes #103)

Required for 3.1 compat
  • Loading branch information...
commit a3ff187938119a12facb2c02b385bb373f188677 1 parent 2dff101
Ingo Schommer chillu authored

Showing 1 changed file with 4 additions and 1 deletion. Show diff stats Hide diff stats

  1. +4 1 code/model/Translatable.php
5 code/model/Translatable.php
@@ -1498,7 +1498,10 @@ static function get_existing_content_languages($className = 'SiteTree', $where =
1498 1498 $dbLangs = $query->execute()->column();
1499 1499 $langlist = array_merge((array)Translatable::default_locale(), (array)$dbLangs);
1500 1500 $returnMap = array();
1501   - $allCodes = array_merge(i18n::$all_locales, i18n::$common_locales);
  1501 + $allCodes = array_merge(
  1502 + Config::inst()->get('i18n', 'all_locales'),
  1503 + Config::inst()->get('i18n', 'common_locales')
  1504 + );
1502 1505 foreach ($langlist as $langCode) {
1503 1506 if($langCode && isset($allCodes[$langCode])) {
1504 1507 if(is_array($allCodes[$langCode])) {

3 comments on commit a3ff187

cam-findlay

Getting error when accessing CMS admin possibly related to this change.

[Notice] Undefined offset: 0
GET /admin/pages/?locale=en_NZ&

Line 1498 in /Applications/MAMP/htdocs/translatable/code/model/Translatable.php

cam-findlay

Further inspection:
Config::inst()->get('i18n', 'all_locales') returns array in the format "locale => langName"

Config::inst()->get('i18n', 'common_locales') return an array in the format "locale => array('name'=>langName, 'native'=>langName).

When these get merged it creates inconsistant array of data...

bhongong

Is this fixed already?

Please sign in to comment.
Something went wrong with that request. Please try again.