diff --git a/src/Providers/Theme.php b/src/Providers/Theme.php index 67d280c..dca70b4 100644 --- a/src/Providers/Theme.php +++ b/src/Providers/Theme.php @@ -37,11 +37,16 @@ public function custom($name, $data) $this->customData[$name] = $data; if (method_exists($this, 'custom_' . $name)) { - $function = new \Twig_SimpleFunction($name, [$this, 'custom_' . $name], ['is_safe' => ['html']]); - $this->theme->addFunction($function); + $this->addFunction($name, $this); } } + public function addFunction($name, $obj) + { + $function = new \Twig_SimpleFunction($name, [$obj, 'custom_' . $name], ['is_safe' => ['html']]); + $this->theme->addFunction($function); + } + public function custom_baun_nav() { $data = $this->customData['baun_nav'];