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

HtmlEditorConfig::get('cms')->setOption for tinymce


Go to End


2 Posts   3823 Views

Avatar
Michi69

Community Member, 3 Posts

13 September 2009 at 10:52am

Hallo,

tiny mce editor puts <p> tags automaticly in my html source code.

I want to stop it in the _config.php like this:

HtmlEditorConfig::get('cms')->setOptions(array('apply_source_formatting'=>'false'));
HtmlEditorConfig::get('cms')->setOptions(array('forced_root_block'=>'p'));

or in the page.php:

public function getCMSFields() {
$fields = parent::getCMSFields();

HtmlEditorConfig::get('cms')->setOption('verify_html', 'false');
HtmlEditorConfig::get('cms')->setOption('apply_source_formatting,'false');
HtmlEditorConfig::get('cms')->setOption('forced_root_block','p');

return $fields;
}
but nothing works for me.

Any helpful suggestions?

Thanks Michi

Avatar
Michi69

Community Member, 3 Posts

17 September 2009 at 8:48pm

ok, this works fine for me :

see here:

http://open.silverstripe.com/ticket/4390

in mysite/_config.php:

Object::add_extension("LeftAndMain", "MyLeftAndMainDecorator");

in mysite/code/ I made a new file MyLeftAndMainDecorator.php and put into:

<?php
class MyLeftAndMainDecorator extends LeftAndMainDecorator
{
function init()
{
HtmlEditorConfig::get('cms')->setOptions( array ('valid_elements'=>'*[ * ]', 'forced_root_block'=>false));
}
}
?>