Please see the coding standards and widget factory documentation.