Drupal.tmBundle

Since there are quite some Drupal developers on the Macintosh platform using the awesome TextMate, Steven Wittens already created a TextMate Bundle (A collection of snippets, key commands etc. for TextMate) for Drupal development. However, his bundle “only” contains parameter hinting for Drupal functions.

The Drupal.tmBundle in action.

While this is pretty useful, looking up functions is a less common task, at least for me. Therefore, I created a new bundle that contains tab triggers for almost all forms api stuff. Just type textfield, press tab and you have a complete definition of a textfield. It gets even better: The cursor is automatically position inside the #title’s t() function. Now enter an appropriate title and press tab again. Voilà, you’re at the next item you can change (the #description in this case).

But not only form api types but also single values as well as complete hooks are included in this shiny new bundle. (It’s not finished though.)

Note: There is now a Drupal bundle in the TextMate repository which contains this bundle and many more functions. It is also updated for Drupal 6. To obtain the bundle, check out http://macromates.com/svn/Bundles/trunk/Review/Bundles/PHP%20Drupal.tmbu... with Subversion.

Comments

1
Steven Wittens on December 10, 2006

Cool, I played around with it for a bit. Definitely very useful.

Some ideas:

  • Create a whole $form[...] = ... statement instead of just the array. Use regexp replacement in the snippet to fill in the array key name based on the title (e.g. “Bandwidth optimizations” to “bandwidth-optimizations”).
  • Nest the tab triggers for the properties. I.e., first you tab, and the whole line with #title is selected. At that point, you can hit delete to remove the property alltogether. Hit tab again, and now you’re on the actual attribute value.
2
Mark Shropshire on December 11, 2006

Thank you and Steven for creating these Bundles. I have used Steven’s for a while now and find it very useful. The Mac, Drupal and TextMate are a great combination for developing web sites and even web applications.

Thanks! Mark

3
Moshe Weitzman on December 11, 2006

great stuff. thanks.

we should merge and centralize this bundle and steven’s bundle into macromates SVN.

4
Sheldon Rampton on March 24, 2007

Great! I second Moshe’s suggestion, with one amendment: there should be separate prefab bundles for Drupal 4.6, 4.7 and 5.x.

5
moshe weitzman on June 12, 2007

both of steven’s suggestions above are excellent.

i had another idea for a similar feature - snippits for cerating cck content types that can be pasted into the content_copy.module textarea. i hate building cck types using the web.

6
Bevan on January 17, 2008

we should merge and centralize this bundle and steven’s bundle into macromates SVN. Yes please! maintaining all these drupal textmate bundles is a real chore. This, together with GetBundle bundle it would be heaps easier.

7
Visitor on January 17, 2008

I’d be more than happy to help with getting a Drupal TextMate bundle going in the Macromates SVN, so let me know if you’d like some help.

8
moshe weitzman on January 17, 2008

bug report - the definition of ‘file’ has #type defined twice. the second one is wrong so the field does not work.

or i altered the bundle somewhere.

9
Konstantin on January 24, 2008

Bevan, I actually asked in ##textmate for an SVN account, but I’ve been told that a Drupal bundle is not the type of bundles they want in their repository. I might go and ask again sometime.

10
Bubo on February 27, 2008

Cool! Thats relly useful, thank you. I’ll present it in my blog the next week to spread the word :-) Are you accepting feature proposals? ;-)

11
Visitor on May 29, 2008

I’m using drupal two years and i love it

Great post