June 2017
Beginner to intermediate
368 pages
8h 31m
English
Notice how the link to the QR Code image is generated by the moodleurl::make_pluginfile_url() function. This creates a link to the pluginfile.php file serving script, referencing the required file.
In order to serve files from the file store, we need to implement the pluginfile function in lib.php. This is a callback function that Moodle uses to serve files from the file store, but one that is specific to this block. This function is described in the Moodle documentation at https://docs.moodle.org/dev/File_API#Serving_files_to_users.
Let's now explore the file serving method in full. The function opens with the following code:
function block_qr_code_pluginfile($course, $birecord_or_cm, $context, $filearea, ...
Read now
Unlock full access