Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Test for MDL-52081
<?php
include "config.php";
require_once($CFG->libdir.'/formslib.php');
$PAGE->set_url(new moodle_url('/test.php'));
$PAGE->set_context(context_system::instance());
class test_form extends moodleform {
/**
* Form definition
*/
public function definition() {
$mform = $this->_form;
$mform->addElement('warning', 'insane', null, 'INSANE');
$mform->addElement('submitlink', 'sl', 'SubmitLink');
$mform->setType('sl', PARAM_RAW);
$mform->addElement('htmleditor', 'test', 'Test');
$mform->setType('test', PARAM_RAW);
$obj = new stdClass();
$obj->mainhtml = 'unknwon';
$obj->rowhtml = 'unknown';
$hubitems = array('unknown' => $obj);
$mform->addElement('listing','huburl', '', '', array('items' => $hubitems,
'showall' => get_string('showall', 'block_community'),
'hideall' => get_string('hideall', 'block_community')));
$mform->setDefault('huburl', 'unknown');
$this->add_action_buttons();
}
}
$form = new test_form();
echo $OUTPUT->header();
if ($data = $form->get_data()) {
echo "<pre>";print_r($data); echo "</pre>";
}
$form->display();
echo $OUTPUT->footer();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.