From 0c1c84e76498812f43b74c424412a18270392f6a Mon Sep 17 00:00:00 2001 From: David Bogner Date: Wed, 24 Jan 2024 10:06:00 +0100 Subject: [PATCH] Fix function declaration --- field/picture/renderer.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/field/picture/renderer.php b/field/picture/renderer.php index 9dc1a0ec..48b7fa69 100644 --- a/field/picture/renderer.php +++ b/field/picture/renderer.php @@ -73,9 +73,7 @@ public function render_edit_mode(MoodleQuickForm &$mform, stdClass $entry, array */ public function render_display_mode(stdClass $entry, array $options): string { global $CFG, $PAGE; - $PAGE->requires->js_call_amd('mod_datalynx/zoomable', 'init'); - $field = $this->_field; $fieldid = $field->id(); $entryid = $entry->id; @@ -110,13 +108,11 @@ public function render_display_mode(stdClass $entry, array $options): string { $strfiles = array(); foreach ($files as $file) { if (!$file->is_directory()) { - $filename = $file->get_filename(); $filenameinfo = pathinfo($filename); $path = "/{$field->df()->context->id}/mod_datalynx/content/$contentid"; - if (strpos($filename, 'thumb_') === false) { - $strfiles[] = $this->display_file($file, $path, $altname, $options); + $strfiles[] = $this->display_file($file, $entryid, $path, $altname, $options); } } } @@ -137,7 +133,15 @@ public function pluginfile_patterns() { "[[{$fieldname}:lightbox]]"); } - protected function display_file($file, $path, $altname, $params = null) { + /** + * @param stored_file $file + * @param int $entryid + * @param $path + * @param $altname + * @param $params + * @return moodle_url|string + */ + protected function display_file(stored_file $file, int $entryid, string $path, string $altname, ?array $params = null) { $field = $this->_field; $imgattr = array('style' => array());