Summary: This article outlines how Moodle Theme items need to be prepared and the technical requirements expected for this item type.
Please note: There are three parts to preparing your item to sell on Envato. This process includes the item preparation and technical requirements for certain items (as shown below). Make sure to also review our overall Quality Requirements and Technical Requirements as well as Legal Requirements to cover all the bases and get through review!
Technical Requirements
You must follow the below Moodle guides in addition to the Envato Market technical and documentation requirements outlined in this article.
PHP
Following are the PHP requirements for Moodle Theme submission:
- Code must not have any PHP notices, warnings, or errors.
- PHP short tags are not allowed.
- Please make sure the code adheres to PEAR standards.
- Avoid hard-coded URIs and file paths.
- Use of the eval() function is not allowed.
- We strongly encourage you to always use curly braces even in situations where they are technically optional. Having them increases readability and decreases the likelihood of logic errors being introduced when new lines are added.
For example:
Following code shows incorrect usage:
if ( empty( $somevar ) ) return false;
Following code shows correct usage:
if ( empty( $somevar ) ) { return false;}Or in the context of a template file or other predominantly HTML file:
if ( empty( $somevar ) ) : return false;endif;
HTML & CSS
Following are the HTML and CSS requirements for Moodle Theme submission:
- All author-generated HTML needs to be validated via the W3C validator. However, browser prefixes and any other cutting-edge code will be exempt.
- If a theme uses the HTML5 doctype, it needs to make proper use of semantic HTML5 elements.
- No hardcoded inline styles are allowed anywhere.
- IDs and classes need to be appropriately named and follow a naming convention.
- Use human-readable selectors that describe what element(s) they style.
- Refrain from using over-qualified selectors; div.container can simply be stated as .container.
- Keep media queries grouped by media at the bottom of the stylesheet.
JavaScript
Following are the JavaScript requirements for Moodle Theme submission:
- JavaScript code should be placed in external files whenever possible.
- JavaScript files need to be placed in the footer where possible, barring notable exceptions, for example, Modernizr, jQuery UI, etc.
- The code should not raise any errors or notices.
- All JavaScript should be written with use strict mode on. For example, you can do this with jQuery as follows:
( function($) { "use strict"; // Author code here })(jQuery);
Documentation Requirements
Following are the documentation requirements for Moodle Theme submission:
- You must provide sufficient documentation to help customers with installation and setup.
- The full installation process of the theme must be documented.
- All required extensions must be documented in your item description and a documentation file.
- Custom features falling outside Moodle’s core functionality must be clearly documented.