Skip to content

Commit

Permalink
added support for alias function on twig
Browse files Browse the repository at this point in the history
  • Loading branch information
yourjhay committed May 18, 2020
1 parent 024cebf commit f4aa131
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion app/Helper/Twig/FunctionExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ public function getFunctions()
* it the twig template.
* new TwigFunction($function_name_to_be_called_in_template, [$callable, method_name])
*/
new TwigFunction('phpinfo', [$this,'phpinfo']),
new TwigFunction('phpinfo', [$this,'phpinfo']),
new TwigFunction('alias', [$this,'alias']),

];
}
Expand All @@ -34,4 +35,12 @@ public function phpinfo()
return phpinfo();
}

/**
* To call aliases in your views eg: alias('route.alias')
*/
public function alias($var, $param=null)
{
return alias($var, $param);
}

}

0 comments on commit f4aa131

Please sign in to comment.