When Modules Collide

I just encountered a problem arising from a combination of the TinyMCE WYSIWYG module and the FAQ module in Drupal 6.

In a nutshell:

  • Unless otherwise configured, the TinyMCE module attaches a WYSIWYG editor to any HTML textarea it encounters on a node editing page.
  • The FAQ module takes the liberty of modifying the node editing form, using the title field to store the Question, and making it a textarea instead of a textfield.
  • Drupal escapes any HTML it finds in a node's title field.

The Question (title) field was getting wrapped in a WYSIWYG editor, which was wrapping some HTML around the field contents... when the FAQ node was saved and displayed, that HTML was getting escaped and showing up on screen.

Suspecting that I couldn't have been the first person to encounter this problem, I went searching on Drupal.org and found an issue in the FAQ module queue: http://drupal.org/node/254336

That issue contained a link to another page describing how to write a custom theme function for TinyMCE and tell it to leave specific fields alone: http://drupal.org/node/179462

So, by adding a theme function to my theme's template.php file, I was able to disable TinyMCE for all fields named 'title'... problem solved.

I'm continually impressed by how many Drupal issues like this can be resolved without hacking either the module or the Drupal core. The resolution sometimes seems a bit tedious, especially when you've looked at the module code and can see right where you could fix it with one extra line or conditional block, but when it comes time to upgrade it is well worth not having to remember what hacks you made and where.