Skip to content

Commit

Permalink
MBS-9397: Error handling if set_anchor does not exist or is a string (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
fdagner authored Oct 7, 2024
1 parent e36d4f0 commit 1c050e8
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions block_qr.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function get_content() {

switch ($this->config->options) {
case 'currenturl':
$qrcodecontent = $this->page->url->out(false);
$qrcodecontent = $this->page->url;
$description = get_string('thisurl', 'block_qr');
$qrcodelink = $qrcodecontent;
$qrurl = true;
Expand All @@ -117,7 +117,7 @@ public function get_content() {
'/course/view.php',
['id' => $context->courseid]
)
)->out(false);
);
$qrcodelink = $qrcodecontent;
$description = $this->config->courseurldesc;
$qrurl = true;
Expand All @@ -136,12 +136,12 @@ public function get_content() {
$qrcodelink = $qrcodecontent;
} else {
$description = $module->name;
$qrcodecontent = $format->get_view_url($module->sectionnum)->out(false);
$qrcodecontent = $format->get_view_url($module->sectionnum);
$anchor = 'module-' . $id;
$qrcodecontent->set_anchor($anchor);
$qrcodelink = $qrcodecontent;
}
break;
break;
case 'section':
$sectioninfo = $modinfo->get_section_info($id);
if (!is_null($sectioninfo)) {
Expand All @@ -154,7 +154,7 @@ public function get_content() {
}
}

$qrcodecontent = $format->get_view_url($id)->out(false);
$qrcodecontent = $format->get_view_url($id);
$anchor = 'section-' . $id;
$qrcodelink = $qrcodecontent;
}
Expand Down Expand Up @@ -279,7 +279,7 @@ public function get_content() {
$javascripturl = $CFG->wwwroot . '/blocks/qr/js/qrcode.min.js';

$data = [
'qrcodecontent' => $qrcodecontent,
'qrcodecontent' => is_object($qrcodecontent) ? $qrcodecontent->out(false) : $qrcodecontent,
'description' => $description,
'javascript' => $javascripturl,
'size' => $svgsize,
Expand All @@ -291,7 +291,7 @@ public function get_content() {
'calendarlocation' => $calendarlocation,
'calendarstart' => $calendarstart,
'calendarend' => $calendarend,
'qrcodelink' => $qrcodelink,
'qrcodelink' => is_object($qrcodelink) ? $qrcodelink->out(false) : $qrcodelink,
'urlshort' => $urlshort,
'fullview' => $fullview,
'configshortlink' => $configshortlink,
Expand Down

0 comments on commit 1c050e8

Please sign in to comment.