public function createTemplate(Control $control = NULL)
{
if ($control === NULL) {
$control = $this->application->presenter;
}
$template = $this->templateFactory->createTemplate($control);
$template->_imagePipe = $this->imagePipe;
$template->locale = isset($control->getPresenter()->locale) ? $control->getPresenter()->locale : NULL;
$template->addFilter('file', function ($path) {
return $this->imagePipe->getPath() . '/' . $path;
});
$template->addFilter('mangleEmail', function ($mail) {
$parts = str_split($mail);
$str = '';
foreach ($parts as $item) {
$str .= '&#' . ord($item) . ";";
}
return $str;
});
return $template;
}