Skip to content

Commit

Permalink
# Updated
Browse files Browse the repository at this point in the history
- En el método <code>addFunction</code> ahora se verifica que el contenido del parámetro <code>$function</code> pueda ser llamado como una función antes de crear la función en Twig.
  • Loading branch information
egaro authored and egaro committed Feb 19, 2018
1 parent 4d9da72 commit f759203
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Twig.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ public function addGlobal($name, $value) {
* Add a function to use in templates
*/
public function addFunction($name, $function) {
$this->twig->addFunction(new \Twig_Function($name, $function));
if (is_callable($function)) {
$this->twig->addFunction(new \Twig_Function($name, $function));
return TRUE;
}
return FALSE;
}

/**
Expand Down

0 comments on commit f759203

Please sign in to comment.