Closed jvanremoortere closed 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'";
}
}
});
controller()
should probably be getController()
if(!$form->getController() instanceof \Responsiv\Campaign\Controllers\Messages) {
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...
Yes thats true, have you tried passing the toolbarOptions through the template
{richeditor toolbarButtons="a,b,c"}...{/richeditor}
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
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.
Makes sense. Glad you got it working!
How could we change (best practice) the toolbarButtons for a richeditor used in a template?