Posted by Diogenes on August 22, 2011 at 9:31pm
Firstly, I'm quite impressed by the wysiwyg module, having spent the better part of the last 3 days looking at the code and trying to figure out how to change the size of the wysiwyg window that appears. I thought I could just add a css file to override the defaults but that clearly does not work when the height property is coded inline. (D7, wysiwyg module, ckeditor library)
I eventually had success with hook_wysiwyg_editor_settings_alter() BUT it was necessary to either add this hook to an existing module or create a separate module specifically for that purpose.
I was hoping to do this with a theme. Can anyone provide guidance on this? Can a module hook be called from a theme?

Comments
Can you please detail how you
Can you please detail how you did this? Also agree, this should be part of the GUI and module settings.
Site Specific Custom Module
It's standard and best practise to create a custom module specific to your site. It is within this module that you would add custom override (hook) functions such as hook_wysiwyg_editor_settings_alter() that are specific to your site. This cannot be done nor should it be done at the theme level. Unfortunately this is not clear and often a stumbling block for those attempting to customise their site beyond the theme layer.
It's not possible to use the
It's not possible to use the template.php file in the theme directory to do this?
If not:
Can you give me a simple example on how to do this or perhaps a link to a tutorial?
Any help will be greatly appreciated since this will be my first module.
Thanks!
Adjusting the ckeditor window height...
Sure - here is some sample code to set the ckeditor window size to 100px high. I believe the default is 420px.
function mymodule_wysiwyg_editor_settings_alter(&$settings, $context) {if($context['profile']->editor == 'ckeditor') {
$settings['height'] = 100;
}
}
I tried this and the function
I tried this and the function does not appear to be called.. is there a something I have to trigger to get this called or is it just supposed to run when you put in the code and load a page?
Edit: Nevermind, you had to go to the node edit page to see a var_dump of the settings :)
Nice
Thank you for supplying this code, it was really helpful for me.
Yes, it is possible
Your post got me wondering if that would work - using the same hook in a theme versus a module.
It did work! Drupal never ceases to amaze me.
To summarize:
function mymodule_wysiwyg_editor_settings_alter()
in file mymodule.module in the mymodule directory
did exactly the same as:
function mytheme_wysiwyg_editor_settings_alter()
in file template.php in the theme directory
So thank you madeby, for answering my original question for me!
-Dio
ETA: this was only tested on D7 - your mileage may vary.
I disagree
@DeeZone
On the second point - it can be done (see above).
On the first point - the objective here was to change the size of a single existing element - the edit box. We are not adding any new information or querying the db for a new twist on what we already have - it is simply altering the appearance (i.e. the theme) slightly.
The Drupal 7 theming system is pretty rich and versatile (maybe too rich). It's really easy to derive a sub theme and monkey around with it. What is not so easy is understanding all the possibilities for overriding the presentation or even or rearranging the order of the data that is available.
My rule of thumb is to only create a new module only when it is absolutely necessary and obvious, otherwise try to do what you want within a theme. You would be surprised how often that works.
Limiting the height settings by content type
I added the code to the template.php file of my theme and it works great. My question is how would you limit the height settings by content type and/or by field? I am interested in limiting the height of the body field only on the comments form, not the body field of regular content types.