Closed (fixed)
Project:
Wysiwyg
Version:
6.x-2.3
Component:
Editor - TinyMCE
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
21 Mar 2011 at 16:27 UTC
Updated:
12 Apr 2011 at 21:51 UTC
When looking at the documentation on TinyMCE's site, they always mention editing the tinyMCE.init function. How can I do that properly with the WYSIWYG module?
Comments
Comment #1
twodWysiwyg creates a settings object in PHP which is then converted to JavaScript and passed directly to the new editor instance when it's created.
You can modify the settings object just after it has been created in PHP by implementing hook_wysiwyg_editor_settings_alter() in a Drupal module. Documentation is in wysiwyg.api.php, #964978: Document hook_wysiwyg_editor_settings_alter() and there are more examples to be found in the issue queue by searching for that hook name.
If the TinyMCE documentation tells you to add a plugin name to the list of plugins to be loaded, and/or a button name to a toolbar, I instead recommend to implement hook_wysiwyg_plugins() (also documented in wysiwyg.api.php). That hook lets Wysiwyg know you've placed a plugin somehere (outside the TinyMCE folder is recommended to make upgrades easier), where it is and what it's called, which buttons it provides and some other "meta data". Implementing that hook makes the plugin's button(s) show up under admin/settings/wysiwyg -> "Buttons and plugins" and it makes the integration re-usable for other sites and people. Wysiwyg will also know it only needs to load the plugin if one or more of it's buttons have been enabled, unless it's a pure "extension" without buttons - in which case the plugin is loaded whenever its checkbox is checked.
If you need more info, or need help with something specific the TinyMCE docs tell you to do, feel free to mark this as active again.