aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/phpbb/template/twig/extension.php15
1 files changed, 13 insertions, 2 deletions
diff --git a/phpBB/phpbb/template/twig/extension.php b/phpBB/phpbb/template/twig/extension.php
index f6f8e03ca2..3c2c8418e6 100644
--- a/phpBB/phpbb/template/twig/extension.php
+++ b/phpBB/phpbb/template/twig/extension.php
@@ -85,6 +85,7 @@ class extension extends \Twig_Extension
{
return array(
new \Twig_SimpleFunction('lang', array($this, 'lang')),
+ new \Twig_SimpleFunction('lang_defined', array($this, 'lang_defined')),
);
}
@@ -136,7 +137,7 @@ class extension extends \Twig_Extension
*
* @return mixed The sliced variable
*/
- function loop_subset(\Twig_Environment $env, $item, $start, $end = null, $preserveKeys = false)
+ public function loop_subset(\Twig_Environment $env, $item, $start, $end = null, $preserveKeys = false)
{
// We do almost the same thing as Twig's slice (array_slice), except when $end is positive
if ($end >= 1)
@@ -165,7 +166,7 @@ class extension extends \Twig_Extension
*
* @return string
*/
- function lang()
+ public function lang()
{
$args = func_get_args();
$key = $args[0];
@@ -182,4 +183,14 @@ class extension extends \Twig_Extension
return call_user_func_array(array($this->language, 'lang'), $args);
}
+
+ /**
+ * Check if a language variable exist
+ *
+ * @return bool
+ */
+ public function lang_defined($key)
+ {
+ return call_user_func_array([$this->language, 'is_set'], [$key]);
+ }
}