Skip to content

Instantly share code, notes, and snippets.

@marinaglancy
Created November 10, 2015 03:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marinaglancy/8c9071a5cbd7bd198b4f to your computer and use it in GitHub Desktop.
Save marinaglancy/8c9071a5cbd7bd198b4f to your computer and use it in GitHub Desktop.
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