From 400f6a35676bde924ab23924cff749c943f9988a Mon Sep 17 00:00:00 2001 From: DaveMeade Date: Tue, 24 Sep 2024 19:42:12 -0400 Subject: [PATCH] allow ->() to get full context --- src/Handlebars/Context.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Handlebars/Context.php b/src/Handlebars/Context.php index 091e84f..d0a0e8c 100755 --- a/src/Handlebars/Context.php +++ b/src/Handlebars/Context.php @@ -226,8 +226,14 @@ public function with($variableName) * @throws InvalidArgumentException in strict mode and variable not found * @return mixed */ - public function get($variableName, $strict = false) + public function get($variableName = null, $strict = false) { + // if no variable name is provided, return the entire context + // this is useful in custom helpers + if ($variableName === null) { + return $this->last(); + } + //Need to clean up $variableName = trim($variableName);