The ModuleFields class is automatically made available to any module. To being using it simply initialize the object within your module method.
Module methods that must return ModuleFields objects include:
- getPackageFields
- getAdminAddFields
- getClientAddFields
- getAdminEditFields
- getClientEditFields
Creating Fields
Creating HTML content
The ModuleFields class supports HTML content as well. You may choose to set nothing but HTML content, but the best practice is to set fields using the method mentioned in the section above and only set javascript and that sort of thing as HTML content.
To set HTML content use the ModuleFields::setHtml() method.
/components/modules/my_module.php
<?php class MyModule extends Module { ... public function getPackageFields($vars=null) { $fields = new ModuleFields(); $fields->setHtml(" <script type=\"text/javascript\">alert('ok!');</script> "); } } ?>