5.1. Coding Style SpecificationsΒΆ

TPPS usually tries to adhere to the Drupal coding style standards. We will cover some of the most important coding style standards here:

  • Tabs are 2 spaces, indent using spaces not tabs.
  • Lines should never end in white space.
  • Starting curly braces should be on the same line as the if/for/while/etc statement, preceded by a space.
  • Ending curly braces should have their own line.
  • Each .php and .inc file should have a comment block describing the file. See any TPPS .php or .inc file for an example.
  • Each function in a .php or .inc file should have a comment block describing the function, as well as all of the parameters, return values, and global variables that the function uses.
  • Use Tripal API functions instead of Drupal API functions.
  • Variable names should use snake_case.
  • Function names in php should use snake_case, in JavaScript should use camelCase.