NDDT can be customized through a series of special templates, as specified in the NDDT options and per project properties windows. These templates allow you to override core hook and theme templates as well as create new module and theme creation templates. Templates follow a simple directory structure:
code
..drupal versions
....hooks
....themes
files
..module
....drupal versions
..theme
....drupal versions
Code contains the actual API templates, while files contains the templates for module and theme creation. Drupal versions is a numerical version of Drupal.
The API Tree templates follow a simple directory structure that equals the tree structure in the API window. Each API item is a special XML file, with the following schema:
<?xml version="1.0" encoding="UTF-8"?>
<item>
<title></title>
<external></external>
<group></group>
<template><![CDATA[
]]></template>
<help><![CDATA[
]]></help>
</item>
The items are rather simple:
The template and help sections must always be enclosed in CDATA.
The core section in the XML file is the template section. Here is the template from hook_action_info:
/**
* Implements hook_action_info();
*/
function ${file_name}_action_info() {
${cursor}
}
The actual code above will be inserted into the editor, which a couple special template variables:
You can also use any of Netbeans code template variables inside your template. For a list of available replacements, please visit this . Make sure the parameter you use is available for PHP.
Using this simple structure it becomes simple to create your own custom code snippets to insert into your files. Simple follow the directory style listed above and create your XML file. Once you reload your project, your new code will be there. You can also override the included templates by copying them, into your custom template library. Make sure you follow the same directory structure to overwrite the template or you may create a separate template in a new directory. You can always retrieve the source templates from GitHub under the release/DrupalDevel folder.
Creation templates are a little different from API templates. They are simple text files with replacement variables. If you decide to create your own creation templates then make sure you include all the files you want in that template. If the template for that version of Drupal and item appear in your custom template path then none of the files from the core tempaltes will be used.
File names in the templates contain one simple replacement variable, _drupal_safe_name_. This will be replaced with the module or theme name when the file is created.
Inside of the template files you have a couple more replacement variables:
That's all there is to customizing the tool. It's very simple to add new items to the tool, but yet very powerful. If you come up with any great template modifications, please share them on GitHub so that everyone can enjoy them.