21299 Posts in 5735 Topics by 2603 members
General Questions
SilverStripe Forums » General Questions » HTMLEditorConfig - per Editor configuration - question from a humble n00b.
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
| Go to End | Next > | |
| Author | Topic: | 1705 Views |
-
HTMLEditorConfig - per Editor configuration - question from a humble n00b.

12 January 2011 at 12:15pm
Hi there,
Just a quick question, any help would be greatly appreciated.
Is it possible to customize the TinyMCE editor on a per 'TinyMCE Editor Field' basis?
ie: I want 3 TinyMCE fields on a page, each one containing only certain buttons and allowed HTML tags etc.
Thanks in advance.
kind regards
James -
Re: HTMLEditorConfig - per Editor configuration - question from a humble n00b.

12 January 2011 at 8:20pm
You can set the htmleditorconfig values in the getCMSField. You can also have multiple htmleditor configs defined and swap between them when making your getCMSFields.
$fields->addFieldToTab('Root.Main', new HtmlEditorField('Field'));
HtmlEditorConfig::set_active('cms-small');
$fields....
HtmlEditorConfig::set_active('...'); -
Re: HTMLEditorConfig - per Editor configuration - question from a humble n00b.

12 July 2011 at 7:06am
Hi all,
Building off of this concept:
Would anything change with setting the config for a front end form?
I have created a new fieldset:
$fields = new FieldSet(
new TextField('Title', 'Product Name'),
new CurrencyField('Price', 'Price'),
new NumericField('TotalAvailable','Total Available'),
new ImageUploadField('MainImage', 'Main Image'),
new HTMLEditorField('Content', 'Product Description')
);Would I still use something like HtmlEditorConfig::set_active('cms-small') after declaring the new fieldset?
Thanks,
Nic
-
Re: HTMLEditorConfig - per Editor configuration - question from a humble n00b.

15 September 2011 at 2:54am Last edited: 15 September 2011 2:55am
Hello Willr,
I can't make your code works
i tried this in my decorator object :
public function updateCMSFields(FieldSet $fields) {
// backup current HtmlEditorConfig identifier (is it usefull ?)
$oldActiveConfig = HtmlEditorConfig::$current;$basicConfig = HtmlEditorConfig::get('basic');
$basicConfig->setButtonsForLine(1, array('bold','italic','underline'));
$basicConfig->setButtonsForLine(2, array());
$basicConfig->setButtonsForLine(3, array());
$basicConfig->setOptions( array(
'friendly_name' =>'Basic HTML Editor'
));HtmlEditorConfig::set_active('basic');
$HtmlEditorField = new HtmlEditorField("Presentation", _t('Presentation.SINGULARNAME', 'Presentation') );
// restore old current HtmlEditorConfig identifier (is it usefull ?)
HtmlEditorConfig::set_active($oldActiveConfig);$fields->addFieldToTab("Root.Main", $HtmlEditorField);
}but all HtmlEditorFields in all Pages (in admin interface) are now 'basic'...
-
Re: HTMLEditorConfig - per Editor configuration - question from a humble n00b.

16 September 2011 at 8:23pm
I found the CustomConfigHtmlEditorField developped by Will in silverstripe-recipes on gitHub
It works great
Thanks Will !
-
Re: HTMLEditorConfig - per Editor configuration - question from a humble n00b.

21 March 2012 at 6:04am
Thanks for the CustomConfigHtmlEditorField tip - that one is really a live-safer
-
Re: HTMLEditorConfig - per Editor configuration - question from a humble n00b.

13 August 2012 at 12:22am
Has anybody successfully done different editor configurations in one form with 3.0? Somehow it's always the last active configuration that gets used for all HtmlEditorFields on the page... I aim to have two fields allowing only bold and italic formatting plus one full-fledged editor field in my form. Whatever i do though, i end up with having one config or the other on all three fields. Is there some way to apply a configuration per editor instance?
Any help greatly appreciated,
mats -
Re: HTMLEditorConfig - per Editor configuration - question from a humble n00b.

13 August 2012 at 2:37am
Here's a video tut by uncle cheese utilizing bootstrap forms with SS3. I think he goes through configuring the HTMLEditorFields:
http://www.leftandmain.com/silverstripe-screencasts/2012/07/03/bootstrap-forms-for-silverstripe-3/
| 1705 Views | ||
| Go to Top | Next > |





