Skip to content

Instantly share code, notes, and snippets.

@ircmaxell
Last active Dec 11, 2015
Embed
What would you like to do?
/**
* retrieves rendered field template
* @param string $templateName
* @param function $prepareTemplateDataFunction a method that accepts 1 param the template data array object and returns it modified before passing it to the template for rendering
* @return string
*/
public function render($templateName, callable $prepareTemplateDataFunction = null){
$template = $this->getTemplate($templateName);
$templateData = $this->getTemplateData();
if($prepareTemplateDataFunction){
$templateData = $prepareTemplateDataFunction($templateData);
}
$template->templateData = $templateData;
return $template->fetch();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment