Update IfHelper.php

To comply with handlebars.js, If adds an extra layer when need to access parents (https://github.com/wycats/handlebars.js/issues/196)
This commit is contained in:
ulriklystbaek 2014-08-28 09:49:32 +02:00
parent c6f3e0fd5e
commit 415a3b00b8

View File

@ -57,15 +57,23 @@ class IfHelper implements Helper
}
if ($tmp) {
$context->push($context->last());
$template->setStopToken('else');
$buffer = $template->render($context);
$template->setStopToken(false);
$template->discard($context);
$context->pop();
} else {
$context->push($context->last());
$template->setStopToken('else');
$template->discard($context);
$template->setStopToken(false);
$buffer = $template->render($context);
$context->pop();
}
return $buffer;