Pull the available languages from the App.Vars.* object.

This commit is contained in:
Alex Tselegidis 2022-01-18 07:20:04 +01:00
parent 380ce3784a
commit ca4e58313a
3 changed files with 4 additions and 3 deletions

View file

@ -99,6 +99,7 @@ class EA_Controller extends CI_Controller {
script_vars([
'base_url' => config('base_url'),
'index_page' => config('index_page'),
'available_languages' => config('available_languages'),
'csrf_token' => $this->security->get_csrf_hash(),
]);
}

View file

@ -249,7 +249,7 @@ window.GeneralFunctions = window.GeneralFunctions || {};
* Enable Language Selection
*
* Enables the language selection functionality. Must be called on every page has a language selection button.
* This method requires the global variable 'availableLanguages' to be initialized before the execution.
* This method requires the global variable 'App.Vars.available_languages' to be initialized before the execution.
*
* @param {Object} $element Selected element button for the language selection.
*

View file

@ -19,7 +19,7 @@ window.App.Utils.Lang = (function () {
* Enable Language Selection
*
* Enables the language selection functionality. Must be called on every page has a language selection button.
* This method requires the global variable 'availableLanguages' to be initialized before the execution.
* This method requires the global variable 'App.Vars.available_variables' to be initialized before the execution.
*
* @param {Object} $target Selected element button for the language selection.
*/
@ -27,7 +27,7 @@ window.App.Utils.Lang = (function () {
// Select Language
const $languageList = $('<ul/>', {
'id': 'language-list',
'html': availableLanguages.map((availableLanguage) =>
'html': App.Vars.available_languages.map((availableLanguage) =>
$('<li/>', {
'class': 'language',
'data-language': availableLanguage,