Coding Standards

The core Ubercart code abides by the Drupal coding standards. Contributed modules that want approval status on our site must conform to these standards.

As we continue development, we will make other requirements known here. These will most likely have to do with using the appropriate hooks to modify the function of the cart instead of some roundabout way. (Even using the right Drupal hooks might be considered "bad" if there is an Ubercart hook designed to do what you're using extra code to do.)

The basic structure being used for Ubercart modules is as follows:

  1. File information
  2. Hook functions: Drupal, TAPIr, Ubercart
  3. Callback functions for menu items, forms, tables, checkout and order panes, line items, etc. Form functions should be in order like so: builder, theme, validate, submit.
  4. Module and helper functions (module specific functions, prefixed by _)

A skeleton module file is available for download in the attachments. You may use it as a starting point for developing your modules. Just go through and modify the appropriate text, remove sections you don't need, and get to coding!

A skeleton .info file has also been included in the download package. You may read about .info files here: http://drupal.org/node/101009. You'll notice that quotation marks around values are optional, but I think it's a good idea for our standard be to use them. (Especially since the package contributed modules goes into has punctuation!)

You'll also notice that it's not necessary to use the umlaut over the U in Ãœbercart. We won't hurt anyone (including ourselves) for calling it Ubercart. Eye-wink

PreviewAttachmentSize
skeleton.tar4 KB