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.

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
Cool, I played around with it for a bit. Definitely very useful.
Some ideas:
$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”).#titleis 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.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
great stuff. thanks.
we should merge and centralize this bundle and steven’s bundle into macromates SVN.
Great! I second Moshe’s suggestion, with one amendment: there should be separate prefab bundles for Drupal 4.6, 4.7 and 5.x.
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.
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.
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.
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.
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.
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? ;-)
I’m using drupal two years and i love it
Great post