mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
MDL-20204 migrated checkbox to html_writer
This commit is contained in:
parent
4461cc604d
commit
7de131039a
@ -158,8 +158,7 @@ if (!isset($frm->acceptechecktypes)) {
|
||||
echo("</ul>");
|
||||
}
|
||||
elseif ($key == AN_METHOD_ECHECK) {
|
||||
$checkbox = html_writer::checkbox('enrol_authorize', AN_METHOD_ECHECK, in_array(AN_METHOD_ECHECK, $paymentmethodsenabled), get_string('method'.AN_METHOD_ECHECK));
|
||||
echo $OUTPUT->checkbox($checkbox, 'acceptmethods[]');
|
||||
echo html_writer::checkbox('acceptmethods[]', AN_METHOD_ECHECK, in_array(AN_METHOD_ECHECK, $paymentmethodsenabled), get_string('method'.AN_METHOD_ECHECK, 'enrol_authorize'));
|
||||
echo("<ul>"); // blockquote breaks <span> and <br> tags
|
||||
$echecktypesenabled = get_list_of_bank_account_types();
|
||||
$allechecktypes = get_list_of_bank_account_types(true);
|
||||
|
@ -3374,11 +3374,11 @@ function choose_from_radio ($options, $name, $checked='', $return=false) {
|
||||
*/
|
||||
function print_checkbox($name, $value, $checked = true, $label = '', $alt = '', $script='', $return=false) {
|
||||
|
||||
// debugging('print_checkbox() has been deprecated. Please change your code to use $OUTPUT->checkbox($checkbox).');
|
||||
// debugging('print_checkbox() has been deprecated. Please change your code to use html_writer::checkbox().');
|
||||
global $OUTPUT;
|
||||
|
||||
if (!empty($script)) {
|
||||
debugging('The use of the $script param in print_checkbox has not been migrated into $OUTPUT->checkbox. Please use $checkbox->add_action().', DEBUG_DEVELOPER);
|
||||
debugging('The use of the $script param in print_checkbox has not been migrated into html_writer::checkbox().', DEBUG_DEVELOPER);
|
||||
}
|
||||
|
||||
$output = html_writer::checkbox($name, $value, $checked, $label);
|
||||
|
@ -1772,43 +1772,6 @@ class core_renderer extends renderer_base {
|
||||
return $this->container($this->render($button), 'closewindow');
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs a <input type="checkbox" /> element. Optgroups are ignored, so do not
|
||||
* pass a html_select_optgroup as a param to this function.
|
||||
*
|
||||
* @param html_select_option $option a html_select_option
|
||||
* @return string the HTML for the <input type="checkbox">
|
||||
*/
|
||||
public function checkbox($option, $name='unnamed') {
|
||||
if ($option instanceof html_select_optgroup) {
|
||||
throw new coding_exception('$OUTPUT->checkbox($option) does not support a html_select_optgroup object as param.');
|
||||
} else if (!($option instanceof html_select_option)) {
|
||||
throw new coding_exception('$OUTPUT->checkbox($option) only accepts a html_select_option object as param.');
|
||||
}
|
||||
$option = clone($option);
|
||||
$option->prepare($this, $this->page, $this->target);
|
||||
|
||||
$option->label->for = $option->id;
|
||||
$this->prepare_event_handlers($option);
|
||||
|
||||
$output = html_writer::start_tag('span', array('class' => "checkbox $name")) . "\n";
|
||||
|
||||
$output .= html_writer::empty_tag('input', array(
|
||||
'type' => 'checkbox',
|
||||
'value' => $option->value,
|
||||
'name' => $name,
|
||||
'id' => $option->id,
|
||||
'alt' => $option->alt,
|
||||
'disabled' => $option->disabled ? 'disabled' : null,
|
||||
'class' => $option->get_classes_string(),
|
||||
'checked' => $option->selected ? 'selected' : null));
|
||||
$output .= $this->label($option->label);
|
||||
|
||||
$output .= html_writer::end_tag('span');
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Output an <option> or <optgroup> element. If an optgroup element is detected,
|
||||
* this will recursively output its options as well.
|
||||
|
Loading…
x
Reference in New Issue
Block a user