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.

Customising the CMS /

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

Remove Image and Flash Button from TinyMCE


Go to End


6 Posts   4568 Views

Avatar
Silverfish

Community Member, 59 Posts

24 May 2011 at 4:30am

Hi there,

does anyone know how to remove the 'Insert Image' and the 'Insert Flash' button from the HTML editor?

I tried HtmlEditorConfig::get('cms')->removeButtons('image') and HtmlEditorConfig::get('cms')->removeButtons('insertimage') but no success (even though it worked fine for several other buttons).

I have no idea at all how to adress the flash button. It is not mentioned on http://tinymce.moxiecode.com/tryit/full.php .

Thanks a lot for any Hint :)

SF

Avatar
Ben_W

Community Member, 80 Posts

24 May 2011 at 4:49pm

try 'HtmlEditorConfig::get('cms')->removeButtons('ssimage')'

The following is one that I used for my last project. make sure it is insert in /mysite/_config.php

HtmlEditorConfig::get('cms')->setButtonsForLine(1, 'bold', 'italic', 'underline', 'strikethrough', 'separator', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'styleselect', 'separator', 'bullist', 'numlist', 'charmap'); 
HtmlEditorConfig::get('cms')->setButtonsForLine(2, 'undo', 'redo', 'separator', 'cut', 'copy', 'paste', 'pastetext', 'pasteword', 'spellchecker', 'separator', 'ssimage', 'ssflash', 'sslink', 'unlink', 'anchor', 'advcode'); 
HtmlEditorConfig::get('cms')->setButtonsForLine(3, ''); 
HtmlEditorConfig::get('cms')->disablePlugins('table', 'contextmenu');

in your case, you just nee to remove 'ssimage', and 'ssflash', just take them out from the list

HtmlEditorConfig::get('cms')->setButtonsForLine(1, 'bold', 'italic', 'underline', 'strikethrough', 'separator', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'styleselect', 'separator', 'bullist', 'numlist', 'charmap'); 
HtmlEditorConfig::get('cms')->setButtonsForLine(2, 'undo', 'redo', 'separator', 'cut', 'copy', 'paste', 'pastetext', 'pasteword', 'spellchecker', 'separator', 'sslink', 'unlink', 'anchor', 'advcode'); 
HtmlEditorConfig::get('cms')->setButtonsForLine(3, ''); 
HtmlEditorConfig::get('cms')->disablePlugins('table', 'contextmenu');

Avatar
Silverfish

Community Member, 59 Posts

24 May 2011 at 7:27pm

HtmlEditorConfig::get('cms')->removeButtons('ssimage', 'ssflash') did it.

Thanks a lot!

SF

Avatar
Silverfish

Community Member, 59 Posts

12 January 2012 at 1:29am

Edited: 12/01/2012 1:29am

Hmmmm...

today, in Silverstripe V. 2.4.6.

HtmlEditorConfig::get('cms')->removeButtons('ssimage', 'ssflash')

has no effect any more.
Neither can I remove the buttons 'anchor' or 'tablecontrols' by this method. Others like 'pasteword' work like expected. All seems pretty strange.
Does anyone know if there were changes since 2.4.4?

Regards
SF

Avatar
Silverfish

Community Member, 59 Posts

30 January 2012 at 3:11am

Please forgive me for refreshing the last post.
I did a lot of research and still have no chance to remove image, flash and anchor from tinymce in Silverstripe 2.4.6.
Anyone any hint?

THX!

Regards
SF

Avatar
g4b0

Community Member, 14 Posts

25 January 2013 at 11:41pm

I'm having the same problem, I can't remove anchor, image and code buttons from the HtmlEditor, neither I can move them into the first line.

How can we proceed?
thanks

g4b0