Robin S Posted October 4, 2016 Share Posted October 4, 2016 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: 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 More sharing options...
fbg13 Posted October 4, 2016 Share Posted October 4, 2016 https://processwire.com/api/ref/sanitizer/unentities/ Never mind didn't read carefully. Link to comment Share on other sites More sharing options...
Robin S Posted October 4, 2016 Author Share Posted October 4, 2016 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)); } }) 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now