forked from mirrors/easyappointments
Added new functions to the render helper that render the global variables and EALang scripts into a view file
This commit is contained in:
parent
6d567a74a4
commit
6c356aec50
3 changed files with 52 additions and 1 deletions
|
@ -18,7 +18,7 @@
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function render_timezone_dropdown($attributes = '')
|
function render_timezone_dropdown(string $attributes = ''): string
|
||||||
{
|
{
|
||||||
$CI = get_instance();
|
$CI = get_instance();
|
||||||
|
|
||||||
|
@ -31,3 +31,35 @@ function render_timezone_dropdown($attributes = '')
|
||||||
'attributes' => $attributes
|
'attributes' => $attributes
|
||||||
], TRUE);
|
], 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);
|
||||||
|
}
|
||||||
|
|
10
application/views/partials/global_variables_script.php
Normal file
10
application/views/partials/global_variables_script.php
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @var string $attributes
|
||||||
|
* @var array $global_variables
|
||||||
|
*/
|
||||||
|
?>
|
||||||
|
<script <?= $attributes ?>>
|
||||||
|
const GlobalVariables = <?= json_encode($global_variables ?? []) ?>
|
||||||
|
</script>
|
||||||
|
|
9
application/views/partials/language_script.php
Normal file
9
application/views/partials/language_script.php
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @var string $attributes
|
||||||
|
*/
|
||||||
|
?>
|
||||||
|
<script <?= $attributes ?>>
|
||||||
|
const EALang = <?= json_encode($this->lang->language) ?>
|
||||||
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue