diff --git a/block_qr.php b/block_qr.php index 2c25ba6..770cf71 100644 --- a/block_qr.php +++ b/block_qr.php @@ -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; @@ -117,7 +117,7 @@ public function get_content() { '/course/view.php', ['id' => $context->courseid] ) - )->out(false); + ); $qrcodelink = $qrcodecontent; $description = $this->config->courseurldesc; $qrurl = true; @@ -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)) { @@ -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; } @@ -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, @@ -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,