mirror of
https://github.com/moodle/moodle.git
synced 2025-04-08 01:43:32 +02:00
Merge branch 'MDL-65523-master' of git://github.com/marinaglancy/moodle
This commit is contained in:
commit
465ed6f107
@ -55,10 +55,13 @@ class data_controller extends \core_customfield\data_controller {
|
||||
$field = $this->get_field();
|
||||
$config = $field->get('configdata');
|
||||
$elementname = $this->get_form_element_name();
|
||||
$mform->addElement('advcheckbox', $elementname, $this->get_field()->get_formatted_name());
|
||||
// TODO MDL-65506 element 'advcheckbox' does not support 'required' rule. If checkbox is required (i.e. "agree to terms")
|
||||
// then use 'checkbox' form element.
|
||||
$isrequired = $field->get_configdata_property('required');
|
||||
$mform->addElement($isrequired ? 'checkbox' : 'advcheckbox', $elementname, $this->get_field()->get_formatted_name());
|
||||
$mform->setDefault($elementname, $config['checkbydefault']);
|
||||
$mform->setType($elementname, PARAM_BOOL);
|
||||
if ($field->get_configdata_property('required')) {
|
||||
if ($isrequired) {
|
||||
$mform->addRule($elementname, null, 'required', null, 'client');
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user