I've updated my Drupal TextMate bundle script to also generate snippets for all PHP internal functions, including correct placeholders for the function arguments. It's a lifesaver when navigating PHP's bizarre Array or String APIs.
The script fetches the PHP function list straight from PHP CVS, but it still needs a Drupal tree to work. You can also copy in the contrib documentation to get snippets for hooks too (which even auto-fill in the module name). All PHP files within the given path are parsed.
To use it, place it in ~/Library/Application Support/TextMate/Bundles and run it:
php generate.php.txt [path to drupal]In TextMate, go to Bundles › Bundle Editor › Reload Bundles to activate it.
(License: GPL)
| Attachment | Size |
|---|---|
| generate.php.txt | 3.99 KB |

Awesome update! Very, very
Awesome update! Very, very useful, beats running to api.drupal.org :-)
Quirks
There are two small 'quirks':
If you'd fix that, the script would be perfect! Thanks.
Sweet, but..
Any hints for how I can get color syntax highlighting in .module and .install files?
The bundle is very sweet, love to have such quick access to all the functions of my particular Drupal installation. Thanks!
Multiple Drupal versions?
Suppose I want to create multiple bundles for different versions of Drupal: one for 4.6, 4.7, 5.x. Is there a way to do that?
Versions
Well, you can generate a bundle for each Drupal version just by renaming the result, but I don't think they would actually work together. There's no easy way to tell which version of Drupal you're coding against anyway. You could swap out the bundles though.
Would be ingenious if you
Would be ingenious if you could make it stick things into categories, for instance based on folders or on prefix. The way things are now, the list if awfully long. Not to mention that the keyboard shortcuts could be based on prefix
examples of keyboard shortcuts:
db ->
list all db functions
taxonomy->
list all taxonomy functions
example of how the menu can be arranged:
-database
--db_query
--db_rewrite_sql
...
-modules
--node
---node_load
---node_access
...
--taxonomy
---taxonomy_get_tree
...
How about a bundle to lookup
How about a bundle to lookup api.drupal.org for the selected function.
Check the .info file, get version and do the lookup for the appropriate version.
That would truly rock!
permission to reuse and republish?
Hi. Many thanks for posting and updating this.
I'd like to adapt the code so it generates an xml variation that's usable for another editor. Am I allowed to create this derived work and republish, giving proper credit?
Thanks.
J.
GPL
I just added a GPL license notice. Feel free to.
Post new comment