21491 Posts in 5783 Topics by 2621 members
General Questions
SilverStripe Forums » General Questions » [solved] HTML Editor Configuration doesn't seem to work for me
General questions about getting started with SilverStripe that don't fit in any of the categories above.
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 1756 Views |
-
[solved] HTML Editor Configuration doesn't seem to work for me

5 March 2010 at 3:53am Last edited: 5 March 2010 4:13am
Hello all
I'm creating a website where I'd prefer to have different WYSIWYG-Editor configurations for different user-groups. Apparently, the CMS already supports that, by allowing the admin to specify a "HTML Editor Configuration" in the "Security" > "Permissions" tab.
The CMS sees my configurations and also displays them in the dropdown. Everything seems to be saved just fine, but the CMS doesn't apply the settings. It always uses the default configuration.
Is there something I have to do myself here? Get the current user-group and apply it's editor config?Any insight would be appreciated. Thanks
-
Re: [solved] HTML Editor Configuration doesn't seem to work for me

5 March 2010 at 4:12am
Figured it out.
Member->getHtmlEditorConfigForCMS() looks up the editor config to use.
It selects the best editor config based on priority.. so if you don't set a priority for your config, you will always end up with the default config.The following solved the problem (default priority is 0):
HtmlEditorConfig::get('customConfig')->setOption('priority', 1);
-
Re: [solved] HTML Editor Configuration doesn't seem to work for me

6 May 2010 at 12:23am
Banal,
Could you explain how you managed to get the result of your first post in this thread. How did you create a custom HTML Editor Configuration and where did you put it?
Thanks!
-
Re: [solved] HTML Editor Configuration doesn't seem to work for me

6 May 2010 at 7:00am
Sure. A good place to define these configurations is in _config.php. Here's an example:
// NORMAL CONFIG
HtmlEditorConfig::get('cms')->disablePlugins('table', 'contextmenu');
HtmlEditorConfig::get('cms')->setButtonsForLine(1,
'bold','separator','pastetext','pasteword','separator','undo','redo','separator',
'sslink','unlink','separator','bullist','numlist','charmap'
);
HtmlEditorConfig::get('cms')->setButtonsForLine(2);
HtmlEditorConfig::get('cms')->setButtonsForLine(3);// ADMIN CONFIG
// create a new config named "admin"
$cfg = HtmlEditorConfig::get('admin');// set the name for the config dropdown
$cfg->setOption('friendly_name', 'Administrators');// set the config priority (must be bigger than 0)
$cfg->setOption('priority', 1);// enable some of the required plugins for silverstripe
// @see /cms/_config.php for the default config!
$cfg->enablePlugins('media', '../../tinymce_ssbuttons', 'fullscreen');// customize your buttons here.. similar to example above?
After doing so, you should be able to select the config for each Member-Group (in the Permissions tab).
I don't know, if this is all the same in 2.4 though. Didn't try it yet. Also have a look at /cms/_config.php and the HtmlEditorConfig class to get some pointers how this all works. -
Re: [solved] HTML Editor Configuration doesn't seem to work for me

6 May 2010 at 8:35pm
Many thanks!
I ended up with just overwriting the existing HTMLEditorConfig for a most simple WYSIWYG editor.
// Set custom TinyMCE configuration
HtmlEditorConfig::get('cms')->setOption('theme_advanced_blockformats','p,h1');
HtmlEditorConfig::get('cms')->setButtonsForLine(1,'undo, redo, separator, cut, copy, pastetext, separator, ssimage, sslink, unlink, separator, fullscreen, advcode, formatselect');
HtmlEditorConfig::get('cms')->setButtonsForLine(2);
HtmlEditorConfig::get('cms')->setButtonsForLine(3); -
Re: [solved] HTML Editor Configuration doesn't seem to work for me

9 November 2010 at 12:29am
Hi all,
I've just the same problem, but my solution doesn't change anything....
I just want to remove some buttons of the tinyMCE:
I've tried:
$cfg = HtmlEditorConfig::get('cms');
$cfg->setOption('priority',1);
$cfg->setButtonsForLine(1,'bold','underline','strikethrough','separator','justifyleft','justifycenter','justifyright','justifyfull','formatselect','separator','bullist','numlist','outdent','indent','blockquote','hr','charmap');
$cfg->setButtonsForLine(2,array('undo','redo','separator','cut','copy','paste','pastetext','pasteword','spellchecker','separator','advcode','search','replace','selectall','visualaid','separator','tablecontrols'));
$cfg->setButtonsForLine(3);but there are still buttons in the third line and there is still the italic-button in the first
I would be very grateful for further assistance!
-
Re: [solved] HTML Editor Configuration doesn't seem to work for me

11 November 2010 at 2:10pm
Sry...i found my mistake!
Too much ' ... only one ' at the beginning and one at the end!
I'm so st***!
| 1756 Views | ||
|
Page:
1
|
Go to Top |


