Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Embed an iframe into a page


Go to End


9 Posts   11220 Views

Avatar
huberd

Community Member, 8 Posts

5 December 2014 at 10:21pm

Edited: 05/12/2014 10:23pm

I'm using a custom getter in Page.php like:

public function getContent(){
        $ret = $this->getField('Content');
        $ret = str_replace('<p><iframe','<iframe', $ret);
        $ret = str_replace('</iframe></p>','</iframe>', $ret);
        return $ret;
    }

But I guess the cleaner solution would be editing the 'valid_elemnts' of TinyMCE in _config.php like:

HtmlEditorConfig::get('cms')->setOption('extended_valid_elements' , '*iframe[ * ]'); //Don't know if it's really *iframe[ * ]

Go to Top