MiTo Team

February 2012

"Collapse" button plugin for CKEditor for Drupal

Several days ago I needed to add an ability to add "spoilers" to comments and nodes at VELOBY.NET web site (Minsk's cycling community). Spoiler is a part of text, that is hidden from viewing by default. It expands by click showing previously hidden content to users.

I've googled nice Collapse Text module for Drupal. Installed it, enabled in input format settings. Everything is fine with it.

We use CKEditor as wysiwyg-editor on VELOBY.NET. And I wanted to add a button to its toolbar, to be able to insert [collapsed]...[/collapsed] meta tags before and after text, selected in editor. Googling almost an hour gave me nothing. So I decided to write own plugin for CKEditor with this functionality.

This small article is about creating this plugin.