Create a Custom Module

Tripal follows Drupal's lead and is designed to be extensible.  Built into the design of Tripal is the idea that every site should have the ability to overhaul and change the default behavior of Tripal and create their own custom sites tailored for their respective research communities.   The previous sections have described how to create custom templates, custom search tools, etc.  The greatest level of control, however, will ciome by creating a custom module.  There are two types of custom modules

  • Site specific modules meant only for internal use (not to be shared).
  • Functional extension modules mean to be shared with others

In both cases the design of the module is the same.  However when creating an extension module with functionality that should be shared care should be taken to avoid design decisions and hard-coded functionality that is site specific. Where possible it is best to create administrative pages that allow others to provide their own site-specific settings.  

Creation of a module requires a good understand of the Drupal API and the Tripal API.  There is a slight learning curve to Drupal and developers who are not familiar with creating Drupal modules should plan to invest some initial time becoming familiar with the Drupal API.   Because Drupal training is availalbe online as well as in books we do not provide instructions here for creating a module.  However, the Tripal package comes with a tripal_example module.  This module is part of Tripal but is not meant to be installed or used.  It serves to provide an example of the Drupal API functions (hooks) and Tripal API functions that are needed to create a custom module.  The Tripal example module is heavily documented to help guide the developer.    The module is designed to be copied, renamed, and edited as needed to help facilitate module development.   

It is recommended that anyone intrested in creating custom modules subscribe to the Tripal Developers Mailing List.  Also, a monthly Developer's teleconference meeting is held each month.  This meeting is open to anyone interested in creating Tripal custom modules.  Attending will allow for interactions with other Tripal developers and perhaps find parterns in development of modules with shared interest.  Meeting annoucements are sent to the mailing list.   Finally, for developers who wish to create custom modules, please request an account on the website.  Once your account is created you will be able to register your new custom module (even if only under development) to help advertise it's develpment and future availablity.  

Have-a-nice-day-icon.png Best Practice Tip. Always be sure to follow the Drupal API, Tripal API and Drupal recommended coding practices. This will ensure that your custom modules will be backwards compatible with newer Tripal updates.