Fix getting the site languages

This commit is contained in:
Flavio Copes
2015-08-18 19:44:07 +02:00
parent cb347ee30f
commit 4f3ef359c8
2 changed files with 22 additions and 1 deletions

View File

@@ -594,6 +594,11 @@ class Admin
return $page;
}
/**
* Return the languages available in the admin
*
* @return array
*/
public static function adminLanguages()
{
$languages = [];
@@ -604,6 +609,22 @@ class Admin
return $languages;
}
/**
* Return the languages available in the site
*
* @return array
*/
public static function siteLanguages()
{
$languages = [];
$lang_data = Grav::instance()['config']->get('system.languages.supported', []);
foreach ($lang_data as $index => $lang) {
$languages[$lang] = LanguageCodes::getNativeName($lang);
}
return $languages;
}
/**
* Static helper method to return current route.
*