responsiv / campaign-plugin

[PREMIUM] Send professional campaign messages to your subscribers.
http://octobercms.com/plugin/responsiv-campaign
5 stars 2 forks source link

RichEditor ToolbarButtons #34

Closed jvanremoortere closed 7 years ago

jvanremoortere commented 7 years ago

How could we change (best practice) the toolbarButtons for a richeditor used in a template?

jvanremoortere commented 7 years ago

This doesn't seem to work...

 // Extend Richeditor
        Event::listen('backend.form.ExtendFields', function($form)
        {
            if(!$form->controller() instanceof \Responsiv\Campaign\Controllers\Messages) {
                return;
            }
            foreach($form->getFields() as $field) {
                if($field->config['type'] == 'richeditor' || $field->config['widget'] == 'richeditor') {
                    $field->config['toolbarButtons'] = "'undo', 'redo', 'clearFormatting', 'html', '|', 'bold', 'italic', 'underline', 'strikeThrough', '|', 'paragraphFormat', 'align', 'fontSize', 'color', '|', 'formatUL', 'formatOL', 'outdent', 'indent', '|', 'insertLink', 'insertImage', 'insertVideo', 'insertTable', '|', 'fullscreen'";
                }
            }
        });
daftspunk commented 7 years ago

controller() should probably be getController()

if(!$form->getController() instanceof \Responsiv\Campaign\Controllers\Messages) {
jvanremoortere commented 7 years ago

Still doesn't do anything... can we access it this way? Is the richeditor "widget" $field->config['type'] == 'richeditor'? or $field->config['widget'] == 'richeditor'?

It's not a normal form that already has config that we can overwrite so...

daftspunk commented 7 years ago

Yes thats true, have you tried passing the toolbarOptions through the template

{richeditor toolbarButtons="a,b,c"}...{/richeditor}

jvanremoortere commented 7 years ago

Just tried it but when you do that, the first icon gets loaded and that's all... Tried it with quotes but than you just get nothing... Would be an easy fix

jvanremoortere commented 7 years ago

Ok. I got it working like you described it above...

Working example:

{richeditor toolbarButtons="undo,redo,clearFormatting,html,|,bold,italic,underline,strikeThrough,|,paragraphFormat,align,fontSize,color" name="content_body" size="large"}{/richeditor}

You can't use spaces.

daftspunk commented 7 years ago

Makes sense. Glad you got it working!