Last updated April 18, 2013. Created on April 18, 2008.
Edited by h3rj4n, lilou, jeremdow. Log in to edit this page.

Komodo Edit is a free, open source editor and cross-platform.

There a few things you can change in Komodo Edit to keep you Drupal coding clean. First you can enable the syntax checking for both PHP and Drupal. Second is configuring Komodo Edit so that it's inline with the code standards.

Syntax checking

If you want to enable syntax checking and auto-completion for standard PHP and Drupal functions in Komodo Edit, here's what to do:

First you need to download and install PHP on your local machine (if you haven't). Make sure to install the same version that you run on your server.
Then, download the version of Drupal that you're using on your site(s) - or if you keep mirror copies of all your Drupal sites on your local machine already, then you could use those instead and pick up all the available functions.

Launch Komodo Edit and go to the preferences of the PHP language (Edit > Preferences, search for PHP) or click on "Check Configuration". This will open a screen, click on the config icon on the same line as PHP. You can find "Check Configuration" on the right side of the start screen of Komodo Edit:

Go into Configure PHP, and you'll want to add the Drupal directory or your site directories under "PHP directories". I only added Drupal 7 because that's the version I'm working with the most.

After you've set everything right, restart Komodo Edit and click on the "Check Configuration" on the start screen. The PHP line should read "PHP Syntax Checking:Ready".

That's it - Komodo Edit will check your syntax and recommend/auto-complete for all php and Drupal functions as you type.

Coding standards

There are a ton of things you'll have to keep in mind to keep your code to the standards of Drupal. Some of the standards can be met by configuring Komodo Edit.

The default way of coding with Drupal is using 2 spaces, not using comments longer that 80 chars and don't leave unnecessary spaces in the file. Those are the settings that will be explained here.

2 spaces

Open the Preferences window (Edit > Preferences). Search for 'Indentation'. Here you can set the default spacing. Set both values to 2. Be sure that both values are also 2 for the PHP language in the drop down.

80 chars comments

Komodo Edit is not able to limit the comment length but it can set a line on the 80th char. Search in the Preferences window for 'Smart Editing'. Here you'll see the option for 'Draw the edge line column'. Be sure that it's checked and that the value is set to 80.

Remove spaces

Komodo Edit can remove unused white spaces. Again open the Preferences window. Search for 'Save Options'. The option 'Clean trailing white spaces ... ' should be checked.

Drupal for Komodo

Be sure to check out the Drupal for Komodo module. This will make it much easier to create new modules. Half of the code is already in Komodo when you start with module development.

Looking for support? Visit the forums, or join #drupal-support in IRC.

Comments’s picture

I used another method with komodo :

  • Create a project in the root folder of the theme or module you are working on.
  • Next, right click on the project and choose "properties" to access the properties dialog window.
  • Select "Language/PHP" and add the root directory of your drupal install.
  • Komodo will scan all of the Drupal code and offering completions for the entire Drupal API (functions, variables, ...).
  • And as Drupal use jQuery, you could enabled the jQuery in the "Code intelligence" section of the preferences.
lelizondo’s picture

I just want to say that this is so cool. Is like a marriage, Komodo & Drupal.


csg’s picture

There's a problem with your approach: what if I work on different projects with different versions of Drupal (e.g. 6 and 7)?

You should create a new project in Komodo Edit and place it in the Drupal root directory instead of adding Drupal at the "PHP Directories". This way you will always have code completion for the Drupal version you are working with at the moment.

thejtate’s picture

Wanted to say that I've been using Komodo with Drupal for a few months now and wanted to say: it's simply the coolest thing next to sliced bread. Thanks again for making this possible.