From 6c356aec506c40d574e5e0eb3be78ca90edcee61 Mon Sep 17 00:00:00 2001 From: alextselegidis Date: Tue, 9 Nov 2021 08:40:20 +0100 Subject: [PATCH] Added new functions to the render helper that render the global variables and EALang scripts into a view file --- application/helpers/render_helper.php | 34 ++++++++++++++++++- .../partials/global_variables_script.php | 10 ++++++ .../views/partials/language_script.php | 9 +++++ 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 application/views/partials/global_variables_script.php create mode 100644 application/views/partials/language_script.php diff --git a/application/helpers/render_helper.php b/application/helpers/render_helper.php index ad55aa82..d101fef5 100644 --- a/application/helpers/render_helper.php +++ b/application/helpers/render_helper.php @@ -18,7 +18,7 @@ * * @return string */ -function render_timezone_dropdown($attributes = '') +function render_timezone_dropdown(string $attributes = ''): string { $CI = get_instance(); @@ -31,3 +31,35 @@ function render_timezone_dropdown($attributes = '') 'attributes' => $attributes ], TRUE); } + +/** + * Render the language script tag. + * + * @param string $attributes HTML element attributes of the script element. + * + * @return string + */ +function render_language_script(string $attributes = ''): string +{ + $CI = get_instance(); + + return $CI->load->view('partials/language_script', [ + 'attributes' => $attributes + ], TRUE); +} + +/** + * Render the global variables script tag. + * + * @param string $attributes HTML element attributes of the script element. + * + * @return string + */ +function render_global_variables_script(string $attributes = ''): string +{ + $CI = get_instance(); + + return $CI->load->view('partials/global_variables_script', [ + 'attributes' => $attributes + ], TRUE); +} diff --git a/application/views/partials/global_variables_script.php b/application/views/partials/global_variables_script.php new file mode 100644 index 00000000..86a81a32 --- /dev/null +++ b/application/views/partials/global_variables_script.php @@ -0,0 +1,10 @@ + + + diff --git a/application/views/partials/language_script.php b/application/views/partials/language_script.php new file mode 100644 index 00000000..43aefc98 --- /dev/null +++ b/application/views/partials/language_script.php @@ -0,0 +1,9 @@ + + +