In PHP it is possible to have a function that its body switches from rendering-mode to code-mode like so:
<?php
function renderA(a){
if(a.label){
?><label></label><?php
} else {
?><span></span><?php
}
}
?>
Is this possible in T4 too? My google search led me here: Is there any way to have functions in basic T4 templates?
But this function definition does not seem to allow this.
Or at least, it is not obvious that it does...
I know this PHP code is not pretty code, but it comes handy when you have to call renderA
many times in a loop to render something. I think ASP.MVC-razor has something similar as well (https://stackoverflow.com/a/6532107/2173353), so I would expect T4 to support this too somehow...