Created
November 29, 2016 08:48
-
-
Save mudrd8mz/28ecbff0453b21d945dba4e2a19af39a to your computer and use it in GitHub Desktop.
Test script to demonstrate MDL-56800
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once(__DIR__.'/config.php'); | |
require_once($CFG->libdir . '/formslib.php'); | |
class test_form extends moodleform { | |
public function definition() { | |
$mform = $this->_form; | |
$grp = []; | |
for ($j = 0; $j < 4; $j++) { | |
$text = 'Text '.$j; | |
$value = 'val_'.$j; | |
$grp[] = $mform->createElement('radio', 'elname', '', $text, $value); | |
} | |
$mform->addGroup($grp, 'grpid', '', "<br />\n", false); | |
$this->set_data([ | |
'elname' => 'val_2', | |
]); | |
} | |
} | |
$PAGE->set_context(context_system::instance()); | |
$PAGE->set_title('test'); | |
$PAGE->set_url('/test-MDL-56800.php'); | |
// Display two forms as non-editable. | |
$form1 = new test_form(null, null, 'post', '', null, false); | |
$form2 = new test_form(null, null, 'post', '', null, false); | |
echo $OUTPUT->header(); | |
echo $OUTPUT->heading('Test 1'); | |
$form1->display(); | |
echo $OUTPUT->heading('Test 2'); | |
$form2->display(); | |
echo $OUTPUT->footer(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment