Merge branch 'MDL-65506-master' of git://github.com/rezaies/moodle

This commit is contained in:
Sara Arjona 2019-06-28 12:16:14 +02:00
commit 5528d03217
2 changed files with 8 additions and 10 deletions

View file

@ -55,8 +55,8 @@ class data_controller extends \core_customfield\data_controller {
$field = $this->get_field();
$config = $field->get('configdata');
$elementname = $this->get_form_element_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.
// If checkbox is required (i.e. "agree to terms") then use 'checkbox' form element.
// The advcheckbox element cannot be used for required fields because advcheckbox elements always provide a value.
$isrequired = $field->get_configdata_property('required');
$mform->addElement($isrequired ? 'checkbox' : 'advcheckbox', $elementname, $this->get_field()->get_formatted_name());
$mform->setDefault($elementname, $config['checkbydefault']);