Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

formslib - checkboxes

Styling forms proves a bit difficult due to the way formslib.php renders the individual form items. Let's look a an example.

Example PHP

$mform->addElement('header', 'checkboxes', get_string('checkboxtest', 'block_simpleblock'));

 $mform->addElement(
   'checkbox',
   'TEACHER',
   'Mr. Smith',
   'History',                      
   array('class'=>'pe_teacher', 'id'=> 'SMITH')
   );
 $mform->addElement(
   'checkbox',                 
   'teachers',  
   'Ms. Miller',
   'Math',                         
   array('class'=>'pe_teacher', 'id'=> 'miller') 
   );

Output HTML

(Only first form item shown.)

<fieldset class="clearfix" id="checkboxes">

 <legend class="ftoggler">Checkbox Test</legend>

</fieldset>