/** * Execute the helper * * @param Handlebars_Template $template The template instance * @param Handlebars_Context $context The current context * @param array $args The arguments passed the the helper * @param string $source The source * * @return {mixed} */ public function execute(Handlebars_Template $template, Handlebars_Context $context, $args, $source) { $parsedArgs = $template->parseArguments($args); $tmp = $context->get($parsedArgs[0]); $context->push($context->last()); if (!$tmp) { $template->setStopToken('else'); $buffer = $template->render($context); $template->setStopToken(false); } else { $template->setStopToken('else'); $template->discard(); $template->setStopToken(false); $buffer = $template->render($context); } $context->pop(); return $buffer; }