MDL-32471 preview thumbnails support for blocks
block_xxx_pluginfile() now accepts the $options parameter that is to be passed to the send_stored_file() function.
This commit is contained in:
+3
-2
@@ -28,9 +28,10 @@
|
||||
* @param string $filearea file area
|
||||
* @param array $args extra arguments
|
||||
* @param bool $forcedownload whether or not force download
|
||||
* @param array $options additional options affecting the file serving
|
||||
* @return bool
|
||||
*/
|
||||
function block_html_pluginfile($course, $birecord_or_cm, $context, $filearea, $args, $forcedownload) {
|
||||
function block_html_pluginfile($course, $birecord_or_cm, $context, $filearea, $args, $forcedownload, array $options=array()) {
|
||||
global $SCRIPT;
|
||||
|
||||
if ($context->contextlevel != CONTEXT_BLOCK) {
|
||||
@@ -64,7 +65,7 @@ function block_html_pluginfile($course, $birecord_or_cm, $context, $filearea, $a
|
||||
}
|
||||
|
||||
session_get_instance()->write_close();
|
||||
send_stored_file($file, 60*60, 0, $forcedownload);
|
||||
send_stored_file($file, 60*60, 0, $forcedownload, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
This files describes API changes in /blocks/* - activity modules,
|
||||
information provided here is intended especially for developers.
|
||||
|
||||
=== 2.3 ===
|
||||
|
||||
required changes in code:
|
||||
* block_xxx_pluginfile() is now given the 7th parameter (hopefully the last one) that
|
||||
contains additional options for the file serving. The array should be re-passed
|
||||
to send_stored_file().
|
||||
|
||||
=== 2.0 ===
|
||||
|
||||
|
||||
+1
-1
@@ -3976,7 +3976,7 @@ function file_pluginfile($relativepath, $forcedownload, $preview = null) {
|
||||
$filefunction = $component.'_pluginfile';
|
||||
if (function_exists($filefunction)) {
|
||||
// if the function exists, it must send the file and terminate. Whatever it returns leads to "not found"
|
||||
$filefunction($course, $birecord, $context, $filearea, $args, $forcedownload);
|
||||
$filefunction($course, $birecord, $context, $filearea, $args, $forcedownload, array('preview' => $preview));
|
||||
}
|
||||
|
||||
send_file_not_found();
|
||||
|
||||
Reference in New Issue
Block a user