knackforge
August 17, 2013
Once the installation of a Drupal instance is done, I guess almost 90% of the developers would first download "What You See Is What You Get". Inline formatting, Text format options, Hyperlinks, Media and iframe support all these makes WYSIWYG a heaven to opt first after installation. No developer would have the heart to say any shortcoming in this feature-rich yet simple module, I am no exception to this too !
But in one of my present projects I had a requirement to change the height of the field which had WYSISYG. For example the body field is what in most cases will have the WYSISYG and I was supposed to make this field of fixed height. At first glance this was a clean CSS work for me. Latter on using Inspect Element in chrome I woke myself up from that dream to see the reality.
The body field had an iframe, which indirectly implies my helpless situation! It was not impossible to do this with CSS, but I wanted a better and perfect solution to make the fix. I went through some API related to WYSISYG and came with the best fix.
The hook_wysiwyg_editor_settings_alter is what does the trick here, replace the hook with your module's name (this must be placed in any of your custom module). I made use of ckeditor as a library for the WYSIWYG module, so make the check equivalent to your library. Once the check passes the height of the WYSIWYG field will be resized to 150px.
This blog can be done with CSS too, but to follow the Drupal way of doing I strongly insist developers to follow this method.
Just like how your fellow techies do.
We'd love to talk about how we can work together
Take control of your AWS cloud costs that enables you to grow!