Jump to:

23377 Posts in 18296 Topics by 2868 members

General Questions

SilverStripe Forums » General Questions » HtmlEditorConfig::get('cms')->setOption for tinymce

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

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

Page: 1
Go to End
Author Topic: 2569 Views
  • Michi69
    Avatar
    Community Member
    3 Posts

    HtmlEditorConfig::get('cms')->setOption for tinymce Link to this post

    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

  • Michi69
    Avatar
    Community Member
    3 Posts

    Re: HtmlEditorConfig::get('cms')->setOption for tinymce Link to this post

    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));
    }
    }
    ?>

    2569 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.