Skip to content

Commit

Permalink
MDL-70288 qtype: Remove unnecessary empty label string
Browse files Browse the repository at this point in the history
* When a label is passed to an (advanced) checkbox and no text
  was provided, the label will be displayed on the right of the the
  checkbox element. So there's no point in passing an empty string for
  the label just to render the text to the right of the checkbox.
  • Loading branch information
junpataleta committed Feb 2, 2021
1 parent 793aa03 commit 2961feb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
6 changes: 2 additions & 4 deletions question/type/ddimageortext/edit_ddimageortext_form.php
Expand Up @@ -116,8 +116,7 @@ public function js_call() {
protected function definition_draggable_items($mform, $itemrepeatsatstart) {
$mform->addElement('header', 'draggableitemheader',
get_string('draggableitems', 'qtype_ddimageortext'));
$mform->addElement('advcheckbox', 'shuffleanswers', ' ',
get_string('shuffleimages', 'qtype_'.$this->qtype()));
$mform->addElement('advcheckbox', 'shuffleanswers', get_string('shuffleimages', 'qtype_'.$this->qtype()));
$mform->setDefault('shuffleanswers', 0);
$this->repeat_elements($this->draggable_item($mform), $itemrepeatsatstart,
$this->draggable_items_repeated_options(),
Expand All @@ -143,8 +142,7 @@ protected function draggable_item($mform) {
get_string('group', 'qtype_gapselect'),
$options,
array('class' => 'draggroup'));
$grouparray[] = $mform->createElement('advcheckbox', 'infinite', ' ',
get_string('infinite', 'qtype_ddimageortext'));
$grouparray[] = $mform->createElement('advcheckbox', 'infinite', get_string('infinite', 'qtype_ddimageortext'));
$draggableimageitem[] = $mform->createElement('group', 'drags',
get_string('draggableitemheader', 'qtype_ddimageortext', '{no}'), $grouparray);

Expand Down
6 changes: 2 additions & 4 deletions question/type/ddmarker/edit_ddmarker_form.php
Expand Up @@ -44,8 +44,7 @@ public function qtype() {
}

protected function definition_inner($mform) {
$mform->addElement('advcheckbox', 'showmisplaced', ' ',
get_string('showmisplaced', 'qtype_ddmarker'));
$mform->addElement('advcheckbox', 'showmisplaced', get_string('showmisplaced', 'qtype_ddmarker'));
parent::definition_inner($mform);

$mform->addHelpButton('drops[0]', 'dropzones', 'qtype_ddmarker');
Expand All @@ -60,8 +59,7 @@ public function js_call() {
protected function definition_draggable_items($mform, $itemrepeatsatstart) {
$mform->addElement('header', 'draggableitemheader',
get_string('markers', 'qtype_ddmarker'));
$mform->addElement('advcheckbox', 'shuffleanswers', ' ',
get_string('shuffleimages', 'qtype_'.$this->qtype()));
$mform->addElement('advcheckbox', 'shuffleanswers', get_string('shuffleimages', 'qtype_'.$this->qtype()));
$mform->setDefault('shuffleanswers', 0);
$this->repeat_elements($this->draggable_item($mform), $itemrepeatsatstart,
$this->draggable_items_repeated_options(),
Expand Down
3 changes: 1 addition & 2 deletions question/type/ddwtos/edit_ddwtos_form.php
Expand Up @@ -49,8 +49,7 @@ protected function data_preprocessing_choice($question, $answer, $key) {

protected function choice_group($mform) {
$grouparray = parent::choice_group($mform);
$grouparray[] = $mform->createElement('checkbox', 'infinite', ' ',
get_string('infinite', 'qtype_ddwtos'), null,
$grouparray[] = $mform->createElement('checkbox', 'infinite', get_string('infinite', 'qtype_ddwtos'), '', null,
array('size' => 1, 'class' => 'tweakcss'));
return $grouparray;
}
Expand Down

0 comments on commit 2961feb

Please sign in to comment.