Created
June 5, 2010 04:31
-
-
Save gwilym/426310 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| From 8f49cae2b5723533f2c335f1ecd892ba718d2e40 Mon Sep 17 00:00:00 2001 | |
| From: gwilym <[email protected]> | |
| Date: Sat, 5 Jun 2010 14:28:16 +1000 | |
| Subject: [PATCH] hack to call closures via twig templates | |
| --- | |
| lib/Twig/Resource.php | 3 +++ | |
| 1 files changed, 3 insertions(+), 0 deletions(-) | |
| diff --git a/lib/Twig/Resource.php b/lib/Twig/Resource.php | |
| index c30a115..7977d26 100644 | |
| --- a/lib/Twig/Resource.php | |
| +++ b/lib/Twig/Resource.php | |
| @@ -42,6 +42,9 @@ abstract class Twig_Resource | |
| $item = (string) $item; | |
| if ((is_array($object) || is_object($object) && $object instanceof ArrayAccess) && isset($object[$item])) { | |
| + if (is_object($object[$item]) && class_exists('Closure', false) && $object[$item] instanceof Closure) { | |
| + return call_user_func_array($object[$item], $arguments); | |
| + } | |
| return $object[$item]; | |
| } | |
| -- | |
| 1.7.0.2.msysgit.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment