Drupal 7 Module Templates for Sublime Text 2

I am a huge fan of the Drupal Textmate project. It saved me quite a bit of time when developing Drupal modules with Textmate. After switching to Sublime Text 2, I have missed the ability to startup a new Drupal module project quickly with a template.

I did a bit of searching and found an existing ST2 package, STProjectMaker, for setting up templates for coding projects. By adding the key map below to your ST2 user key binding settings, you can startup a new project template by pressing Ctrl-Alt-N. Next, pick the project of your choice and complete the project configuration input as prompted.

{ "keys": ["ctrl+alt+n"], "command": "project_maker" }

I just started development of this branch to make it super simple to start up a brand new Drupal 7 module. This template asks for the following input:

  • Project Name - The short name for a module. Used for file and function names.
  • Project Title - The title case name of the module
  • Project Description - This is the short description

Note: A bug in the token detection may cause two additional input requests. Just press return or enter through these. It appears that STProjectMaker's token regex is hitting on the parameters in the hook_help() function in the .module template file. I hope to resolve this soon.

When the STProjectMaker has completed processing, you will have a folder with the following files:

  • project_name.admin.inc
  • project_name.info
  • project_name.install
  • project_name.module
  • project_name.sublime-project
  • project_name.test
  • README.txt

Just review the files and make changes as required!

If this ST2 package is interesting to you, please clone the branch to your ST2 packages folder, give it a test, and send me some issues and/or pull requests. I will submit a pull request to the original STProjectMaker project as soon as I do a bit more testing and get some initial feedback.

Blog Category: