Jump to content

HTML tags rendered literally in PageTable inputfield


Robin S
 Share

Recommended Posts

I have a field that has the Parsedown textformatter applied, and I want to include it as a column in my PageTable field. But entities are encoded (for security?) so the HTML tags are rendered literally:

pt.png

This doesn't look good - even stripping the tags would be better. Is there a way I can avoid the literal tags?

Link to comment
Share on other sites

I solved this with a hook to Fieldtype::markupValue...

$this->addHookBefore('Fieldtype::markupValue', function($event) {
    $f = $event->arguments('field');
    $p = $event->arguments('page');
    $v = $event->arguments('value');
    if($f->name == 'my_field' && $p->template->name == 'my_pt_template') {
        $event->arguments('value', $this->sanitizer->text($v));
    }
})

 

 

  • Like 1
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...