ProcessHannaCode icon indicating copy to clipboard operation
ProcessHannaCode copied to clipboard

Way to output code using php function

Open artarmstrong opened this issue 11 years ago • 1 comments

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!

artarmstrong avatar Jan 08 '15 19:01 artarmstrong

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); 

ryancramerdesign avatar Aug 18 '16 14:08 ryancramerdesign