In order to use the Tripal API the developer should have the following skills:
- Knowledge of PHP.
- Knowledge of Chado and relationships between tables (at least tables where data of interest is stored).
- Familiarity with Tripal's Chado API functions.
For creating custom modules the following additional skills are required:
- Familiarity with Drupal module development
- Familiarity with the Full Tripal API
There are a few rules to follow when updating templates or creating new modules:
- All development should follow standard Drupal coding standards: http://drupal.org/coding-standards.
For working with template files:
- Do not use SQL statements inside of the template files. While you can do this it makes your templates longer and harder to read. Instead always try to use the Tripal API function calls to retrieve data. If you find you must use SQL in a template to perform complex queries, consider writing your own custom module.
- Always copy the template files from the Tripal theme to your own default theme before editing (try to preserve the directory structure when copying). This will ensure that future updates to Tripal will not overwrite your customizations. Drupal will prefer to use the templates in your default theme rather than those with the same name in the Tripal theme.
For custom module development:
- Consider using Drupal's git repository for housing your module development. Drupal allows users new module developers to create their modules within a "Sandbox". You can read more about Drupal's sandbox here: https://www.drupal.org/node/1011196
- In order to ensure your custom module follows all security protocols, consider reviewing your module with an online tool like http://pareview.sh/.
The Drupal Devel Module
Before staring your development work, it is suggested that you download and install the Drupal devel module. This module helps greatly with debugging your custom theme or module. A very useful function of this module is the dpm function. You can use the dpm function to print to the web page an interactive view of the contents of any variable. This can be extremely helpful when accessing Chado data in objects and arrays returned by Tripal.
For example, each template for a node has a node object. If you want to see all of the variables and record present in the node object simply add the following to the top of the template file:
To see a list of all of the variables available to your template you would use the following:
This function can also be used for debugging variables during module development.