Allow editor settings to be set through hook_wysiwyg_editor_config_alter().

quicksketch - November 9, 2009 - 22:24
Project:Wysiwyg
Version:6.x-2.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs review
Description

I think I submitted a patch similar to this once before, but I was unable to find it. In the last several sites I've built I've need to adjust TinyMCE settings or configure options that do not yet exist through the UI. The last patch I submitted received the feedback, "we should make the UI support every option TinyMCE supports". I'm not entirely sure that's a good idea (that's a lot of options) and it's difficult to keep up with all the possible options for all editors.

What I'd like to propose is a hook that lets contrib (or custom in my case) modules modify the WYSIWYG configuration options after the defaults have been set by the appropriate editor .inc file. This would allow for the configuration of esoteric options that don't make sense in the UI, or changing of the defaults that are not allowed to be changed.

There's a lot of similar discussion happening over in #313497: Allow to configure advanced editor settings, including some nice hacks to work around the inability to configure these options with PHP. I'd feel better using a sanctioned method rather than manually inserting things into the Drupal.settings.wysiwyg settings.

AttachmentSize
wysiwyg_config_alter.patch675 bytes

#1

james.cartledge - November 17, 2009 - 21:43

This is a great patch - thanks!
Without this functionality we would have been unable to move from tinytinymce - please commit it.

#2

dereine - November 17, 2009 - 22:31

Patch works fine.
But why not name it wyswiyg_edit_settings_alter. For me it does make a little more sense here.

With this hook, it is also able to build a rundimentary order buttons extra module. I know this should be included into wysiwy itself, see http://drupal.org/node/277954, but as short-time solution it would be able to use this alter hook.

#3

quicksketch - November 18, 2009 - 06:16

The name wyswiyg_edit_settings_alter is a little redundant ("edit" and "alter"). Perhaps you mean wyswiyg_editor_settings_alter? That would be fine by me, of course we'll have to wait and see what sun thinks about adding this hook at all, regardless of its name.

#4

dereine - November 18, 2009 - 06:58

sure. I wanted to write this, too.

 
 

Drupal is a registered trademark of Dries Buytaert.