From f3fc076dfcfc5d3382760b7bf41732c0c69274a2 Mon Sep 17 00:00:00 2001 From: fzerorubigd Date: Mon, 5 Nov 2012 08:51:35 +0330 Subject: [PATCH] add bindAttr helper to default helpers --- src/Handlebars/Helpers.php | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/Handlebars/Helpers.php b/src/Handlebars/Helpers.php index a1186dd..9798ab7 100644 --- a/src/Handlebars/Helpers.php +++ b/src/Handlebars/Helpers.php @@ -45,7 +45,7 @@ class Handlebars_Helpers * * @throw InvalidArgumentException when $helpers is not an array (or traversable) or helper is not a caallable */ - public function __construct($helpers = null, $defaults = true) + public function __construct($helpers = null, $defaults = true) { if ($defaults) { $this->addDefaultHelpers(); @@ -68,8 +68,7 @@ class Handlebars_Helpers { $this->add( 'if', - function ($template, $context, $args, $source) - { + function ($template, $context, $args, $source) { $tmp = $context->get($args); $buffer = ''; if ($tmp) { @@ -81,8 +80,7 @@ class Handlebars_Helpers $this->add( 'each', - function($template, $context, $args, $source) - { + function ($template, $context, $args, $source) { $tmp = $context->get($args); $buffer = ''; if (is_array($tmp) || $tmp instanceof Traversable) { @@ -98,8 +96,7 @@ class Handlebars_Helpers $this->add( 'unless', - function ($template, $context, $args, $source) - { + function ($template, $context, $args, $source) { $tmp = $context->get($args); $buffer = ''; if (!$tmp) { @@ -111,8 +108,7 @@ class Handlebars_Helpers $this->add( 'with', - function ($template, $context, $args, $source) - { + function ($template, $context, $args, $source) { $tmp = $context->get($args); $context->push($tmp); $buffer = $template->render($context); @@ -120,6 +116,14 @@ class Handlebars_Helpers return $buffer; } ); + + //Just for compatibility with ember + $this->add( + 'bindAttr', + function ($template, $context, $args, $source) { + return $args; + } + ); } /**