I have a file in my /local folder to create a form using mform. The form is displaying without any problems but the Atto toolbar is not showing and I cannot find anything in the Forms API documentation to explain how to display it. I suspect there is a class somewhere that I am supposed to initiate but I cannot figure it out. I have written the code below. Atto is activated and is the default (it works fine in moodle core modules - it is just my local customisation that is not working. I am using Moodle 3.0. Thanks for any guindace!
My file is /local/testform.php:
<?
require_once('simplehtml_form.php');
$mform = new simplehtml_form();
if ($mform->is_cancelled()) {
} else if ($fromform = $mform->get_data()) {
} else {
$mform->display();
}
?>
And the form (simplehtml_form.php) itself is:
<?
require_once('config.php');
require_once($CFG->libdir . '/formslib.php');
require_once("$CFG->libdir/form/editor.php");
global $CFG, $PAGE, $DB;
class simplehtml_form extends moodleform {
public function definition() {
global $CFG;
$mform = $this->_form; // Don't forget the underscore!
$mform->addElement('text', 'email', get_string('email')); // Add elements to your form
$mform->setType('email', PARAM_NOTAGS); //Set type of element
$mform->setDefault('email', 'Please enter email'); //Default value
$mform->addElement('editor', 'fieldname', get_string('labeltext', 'langfile'));
$mform->setType('fieldname', PARAM_RAW);
}
//Custom validation should be added here
function validation($data, $files) {
return array();
}
}