-
-
Save ircmaxell/beb8aa744a016837864b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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