ActiveBlog

Setting up Komodo Edit for Drupal development
by

, March 6, 2009

Here at ActiveState HQ, it seems like I am doing more and more Drupal development. We've been using Drupal for a long time for various things, starting with some internal tools I developed to make customer service a bit easier. We launched our community site on Drupal 4.7 a few years ago, and it is still happily running on Drupal 5 and doing all manner of things for our users including Forums, FAQs, and Komodo Extensions hosting. When we launched the Open Komodo site over a year ago, Drupal was a natural choice to host the brochure content and blogs there as the development overhead was very low.

Going forward, I have recently transitioned into a new role here doing web development almost exclusively, and Drupal is always considered a key tool for us for deploying new sites quickly and effectively due tot he depth of the features and community support available to us.

Through all of this, I have of course been using Komodo IDE for all of my development, and this has been reflected in a number of small enhancements I've managed to squeeze into Komodo that make PHP development generally and Drupal development specifically a bit more productive. Drupal for its part helps me immensely by being a nice, clean procedural framework of uncomplicated PHP code; in terms of writing Drupal code in Komodo there is not much you need to do to get a lot of benefit.

Here are some tips for anyone trying out our free ( & open source! ) Komodo Edit editor for Drupal development:

1. Code Intelligence setup.

Komodo is particularly good at autocompletion for PHP code like drupal's; it can find functions like nobody's business. What I tend to do to make sure this works well is this:

  • first I create a project in the root directory of the module or theme I am working on. I tend to have a single project per module
  • second, I right-click on the project, select properties to bring up the Project Properties dialog
  • I click on Languages / PHP and add the root directory of my Drupal site ( where *al* the Drupal code is ) to the 'PHP Directories' list.

The next time I write some code in a PHP file in my Project, Komodo will scan all of the Drupal codebase and start offering completions for the entire Drupal API, including any contrib modules I've installed in /sites/

If you plan on writing any JS / jQuery code in your modules or themes, also be sure to go into Komodo's Preferences and enable the jQuery API Catalog at Preferences / Code Intelligence. This will provide you with great autocompletion for jQuery code.

2. Snippets / Abbreviations

Lo those many years ago I watched those Rails videos and watched in amazement at how Textmate was used to quickly expand brief notations into entire blocks of code at high speed. I liked this feature so much I hacked a version of it into Komodo; we call it 'Abbreviations'.

For more on how to use Abbreviations, please see the online docs. Of particular interest to Drupal developers are a few Drupal-specific snippets for quickly creating a Drupal 5.x module. You can see these in the toolbox under Abbreviations / PHP / Drupal.

Keep in mind that the default key command for inserting a snippet is Ctrl+T ( Cmd +T on OS X ). You *can* however change this to use the TAB key similar to how Textmate works by installing this excellent user macro:

I personally use this Macro, your mileage may vary.

3. Komodo extensions

While there may not (yet) be a Drupal-specific Komodo extension, there are a number of great extensions hosted on our community site that generally enhance how Komodo Edit works for PHP development:

  1. MoreKomodo: various enhancements to Komodo's UI, by rockstar Komodo extension developer Davide Ficano
  2. Todo: scans the current file for 'todo' comments.
  3. Ko-Clippy ( Clipboard Helper ): great extension for copying *and* escaping text in various ways.
  4. Remote Drive Tree: browser remote servers and edit files, similar to the old Homesite interface.

I hope to post a companion piece for this post in a couple of days detailing all the amazing whiz-bang features in Komodo IDE that can offer help for any serious Drupal developer.

Subscribe to ActiveState Blogs by Email

Share this post: