You are here

Customizing the File Creation Templates

Creating new file system templates is much the same as creating code templates with a few exceptions. Let’s look at the templates to create a new Drupal 6 module. The files will be located in files/module/Drupal 6. Inside of that folder you will notice the following items:

Much like the template variables we discussed earlier, _drupal_safe_name_ will replace with the machine name of the module or theme you are creating. This allows you to have dynamically created files, but also you can create a static file. Say you decide you want to include a license.txt file with the same license in every module you create. Simply put that file in your templates and it will be copied over to your new module, keeping the licsense.txt file name.

Inside the files you have two variable replacements available:

  • ${real_name}  - This will be replaced with the real, non-machine safe name of the module or theme.
  • ${safe_name} – This will be replaced with the machine safe name of the module or theme.

An example of this is available in the file:

{syntaxhighlighter brush:php} name = ${real_name} description = core = 6.x package = php = version = dependencies[] = {/syntaxhighlighter}

In this file ${real_name} will become the actual name of our module, as displayed on the module install screen inside of Drupal.