Jump to content
Sign in to follow this  
rash

[Solved] How to format user comments with Textile Restricted?

Recommended Posts

Hi all,

I’m using the Textile module for all of my own and most of my client’s sites and that works just fine. For the first time I have the need to allow a bit basic formatting in a user input textarea delivered by the PW comment system and I don’t know how to "textilize" the comment text. The line in my comments output:

$text = $comment->getFormatted('text');

getFormatted() replaces double line breaks with </p><p> and offers the option to nest the whole thing in opening and closing <p> tags. So I will probably have to get unformatted text instead and format it with Textile Restricted. I guess this will be very easy, but can’t find the right method for it.

Share this post


Link to post
Share on other sites

Got it now – a bit embarassing how long it took:

$text = $comment->text;
$modules->TextformatterTextileRestricted->formatValue(new Page(), new Field(), $text);

Or, in my case, as I format the comments inside a function:

$text = $comment->text;
wire('modules')->TextformatterTextileRestricted->formatValue(new Page(), new Field(), $text);

Suddenly the day showed a brighter coloring.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...