ProcessHannaCode
ProcessHannaCode copied to clipboard
Way to output code using php function
Hey, I am not sure if theres currently a way to do this but I didn't see anything in the readme and after reviewing the code I think it would be something similar to using the "getReplacement" function in the "TextformatterHannaCode".
I need to be able to call a function to output the Hanna code inside of the a template file rather than using the tag inside of the body field. Thanks!
This can be done by using the render() method:
$text = 'text [[text]] text'; // any text with a Hanna code in it
$hanna = $modules->get('TextformatterHannaCode');
echo $hanna->render($text);
If you have the current $page and/or $field, provide them too:
echo $hanna->render($text, $page, $field);