Jump to content

PageTable and html text


LostKobrakai
 Share

Recommended Posts

  • 2 years later...
On 1/01/2017 at 7:26 AM, elabx said:

Is there and update for this question?? 

HTML renders fine for CKEditor fields.

For text or textarea fields there are two possibilities:

Strip the tags...

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

..or decode entities (being mindful of potential security risks that this opens up)...

$this->addHookAfter('Fieldtype::markupValue', function($event) {
    $field = $event->arguments('field');
    $page = $event->arguments('page');
    if($field->name == 'my_field' && $page->template->name == 'my_pagetable_template') {
        $event->return = html_entity_decode($event->return);
    }
});

 

  • 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...