Skip to content

Commit

Permalink
MDL-55696 output: Correct handling of url_select nothingvalue
Browse files Browse the repository at this point in the history
Part of MDL-55071
  • Loading branch information
andrewnicols authored and danpoltawski committed Sep 23, 2016
1 parent 126e1b2 commit ecfad63
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lib/outputcomponents.php
Original file line number Diff line number Diff line change
Expand Up @@ -1222,15 +1222,13 @@ public function export_for_template(renderer_base $output) {
$nothing = false;
if (is_string($this->nothing) && $this->nothing !== '') {
$nothing = ['' => $this->nothing];
$hasnothing = true;
} else if (is_array($this->nothing)) {
$key = key($this->nothing);
if ($key === 'choose' || $key === 'choosedots') {
$nothing = [$key => get_string('choosedots')];
$nothingvalue = reset($this->nothing);
if ($nothingvalue === 'choose' || $nothingvalue === 'choosedots') {
$nothing = [key($this->nothing) => get_string('choosedots')];
} else {
$nothing = [$key => reset($this->nothing)];
$nothing = $this->nothing;
}
$hasnothing = true;
}
$data->hasnothing = !empty($nothing);
$data->nothingkey = $data->hasnothing ? key($nothing) : false;
Expand Down

0 comments on commit ecfad63

Please sign in to comment.