true, 'needs_context' => true, 'is_safe' => ['all'], ] ), ]; } public function generatePartial($env, $context) { // get arguments (minus env & $context) $args = array_slice(func_get_args(), 2); $argsCount = count($args); // default values $alias = null; switch ($argsCount) { case 2: list($id, $file) = $args; break; case 3: list($id, $file, $alias) = $args; break; default: return; } $renderedTemplate = \MailPoetVendor\twig_include($env, $context, $file); $output = << $renderedTemplate EOL; if ($alias !== null) { $output .= << jQuery(function($) { $(function() { Handlebars.registerPartial( '$alias', jQuery('#$id').html() ); }); }); EOL; } return $output; } }