Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » tinymce config

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 5528 Views
  • contigo
    Avatar
    Community Member
    16 Posts

    tinymce config Link to this post

    Which file(s) do I need to edit to change tinymce controls? I've configured tinymce controls in another cms, but simlar edits in SS don't seem to work (version 2.2.2-rc2).

    Thanks

    -Billy

  • sarahk
    Avatar
    Community Member
    46 Posts

    Re: tinymce config Link to this post

    hmmm, just what I need to know too

  • Re: tinymce config Link to this post

    The code for all the TinyMCE buttons is located in /sapphire/forms/HtmlEditorField.php, in the HtmlEditorField_Toolbar class. Check out the buttons function. In order to edit the HTML Editor, but so your changes don't get lost on an update, copy the HtmlEditorField_Toolbar class to another file in your mysite/code directory e.g. AlternateToolbar.php. Also, rename the class name to AlternateToolbar. Once this is done, you can tell SilverStripe to use your custom class to use this instead of the default toolbar by placing

    Object::useCustomClass('HtmlEditorField_Toolbar', 'AlternateToolbar');


    Then any changes you make to the AlternateToolbar class will hopefully appear in the CMS. To edit/add/remove buttons, just edit the Buttons() function. The alternative is to wait until the next release, as I think the toolbar is being updated to be easily configurable.

  • KingBerT
    Avatar
    Community Member
    11 Posts

    Re: tinymce config Link to this post

    I've followed your instructions, but I don't get it work!

    Where do I have to put this line?!

    "Object::useCustomClass('HtmlEditorField_Toolbar', 'AlternateToolbar');

    I've put it into

    mysitenamefolder/_config.php

  • Re: tinymce config Link to this post

    Sorry, i'm afraid i made a mistake with my instructions. Currently the CMS interface doesnt use the factory method to create the toolbar, so the class will not get overridden. However, if you open up cms/code/LeftAndMain.php, and locate the EditorToolbar function, and replace it with

    return Object::create('HtmlEditorField_Toolbar', $this, 'EditorToolbar');


    then your custom class will get used properly. For your custom class, id suggest creating a class that extends HtmlEditorField_Toolbar in your mysite/code directory, and then putting the useCustomClass call in mysite/_config.php - and then override the Buttons function in your custom class.

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