You are here

Netbeans Drupal Devel Tool Development Update

I just pushed out build 2.0.5, which is still a beta status of NDDT. Mostly fixes went in to address issues 12 and 13.

There is one new, minor feature. In the ApiTree window you now have a button to reload:

You really only need to reload the API tree if you are using custom libraries and make a change to the item names or structure. If you just change the code template there is no need to reload since those are only loaded when you do an insert.

Early Christmas - A Hidden Treasure

I must admit that I didn't know much about NetBeans code template variables when I decided to change parsing of NDDT's templates from custom coding to the CodeTemplateManager in NetBeans. Yesterday while working on a Drupal module with a lot of forms I got tired of writing the three functions involved with form building over and over again (form_id, form_id_validate, form_id_submit). I figured there had to be a way to get the tool to do it. I then discovered something I didn't know about the variables in the code templates - you can create your own variable and all occurences will be changed as you type. Here's the snippet I created for NDDT to handle this:

<?xml version="1.0" encoding="UTF-8"?>
	<item>
		<title>Declare Form</title>
		<external></external>
		<group>snippet</group>
		<template><![CDATA[
/**
 * Form builder; ${form_id}
 *
 * @see ${form_id}_validate()
 * @see ${form_id}_submit()
 */		
function ${form_id}($form, &$form_state){
  ${set_cursor}
}

/**
 * Form validation handler for ${form_id}().
 */
function ${form_id}_validate($form, &$form_state){
  ${set_cursor}
}

/**
 * Form submission handler for ${form_id}().
 */
function ${form_id}_submit($form, &$form_state){
  ${set_cursor}
}
]]></template>
		<help></help>
	</item>

Once you insert this snippet the top form_id will be highlighted. As you start typing the actual id of the form you are creating, all occurences will be changed throughout. This makes form creation much simpler!

Speaking of Code Snippets

I'm starting to work on a dedicated site for this tool. One of the main reasons is I want to create a repository where users can share cool snippets like this. I'm hoping to get this up in the near future and can see it becoming a valuable resource for the tool, especially given the increasing popularity (V2 beta had over 100 downloads this week alone!). Stay tuned as I am hoping to get this out really soon!