[[PageOutline]] = Coding Standard = Following [http://en.wikipedia.org/wiki/Coding_standards coding standards] is one of the easiest way for everybody to understand everybody's code. == Indenting and Whitespace == * '''Never use tabulations''' in the code. Indentation is done by steps of '''4 spaces''': {{{ #!php , etc. should have a space before and after the operator, for readability. {{{ #!php key association operator, if applicable: {{{ #!php 'bar'); }}} * Note that if the line declaring an array spans longer than 80 characters (often the case with form and menu declarations), each element should be broken into its own line, and indented one level: {{{ #!php 'textfield', '#title' => t('Title'), '#size' => 60, '#maxlength' => 128, '#description' => t('The title of your node.'), ); }}} * Note the comma at the end of the last array element; This is not a typo! It helps prevent parsing errors if another element is placed at the end of the list later. == String Concatenations == * Always use a space between the dot and the concatenated parts to improve readability. * Avoid evaluating variables within strings, instead opt for concatenation: {{{ #!php ` closing tag. This is because it is not really needed, and because it can create problems in the output if you ever have white space after this tag. * Always use to delimit PHP code, not the shorthand, . == Constants == Use lowercase PHP native typed constants: `false`, `true` and `null`. The same goes for `array()`. At the opposite, always use uppercase strings for user defined constants, like `define('MY_CONSTANT', 'foo/bar')`. Better, try to always use class constants: {{{ #!php