mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 01:16:44 +02:00
MDL-59008 mod_resource: add option to serve external files embed
This commit is contained in:
parent
5a651b43fb
commit
1fad6ff3f5
3 changed files with 17 additions and 7 deletions
|
@ -972,7 +972,9 @@ function file_save_draft_area_files($draftitemid, $contextid, $component, $filea
|
|||
if (!empty($repoid)) {
|
||||
$context = context::instance_by_id($contextid, MUST_EXIST);
|
||||
$repo = repository::get_repository_by_id($repoid, $context);
|
||||
|
||||
if (!empty($options)) {
|
||||
$repo->options = $options;
|
||||
}
|
||||
$file_record['repositoryid'] = $repoid;
|
||||
// This hook gives the repo a place to do some house cleaning, and update the $reference before it's saved
|
||||
// to the file store. E.g. transfer ownership of the file to a system account etc.
|
||||
|
@ -3886,9 +3888,10 @@ class curl_cache {
|
|||
* @param null|string $preview the preview mode, defaults to serving the original file
|
||||
* @param boolean $offline If offline is requested - don't serve a redirect to an external file, return a file suitable for viewing
|
||||
* offline (e.g. mobile app).
|
||||
* @param bool $embed Whether this file will be served embed into an iframe.
|
||||
* @todo MDL-31088 file serving improments
|
||||
*/
|
||||
function file_pluginfile($relativepath, $forcedownload, $preview = null, $offline = false) {
|
||||
function file_pluginfile($relativepath, $forcedownload, $preview = null, $offline = false, $embed = false) {
|
||||
global $DB, $CFG, $USER;
|
||||
// relative path must start with '/'
|
||||
if (!$relativepath) {
|
||||
|
@ -3912,7 +3915,7 @@ function file_pluginfile($relativepath, $forcedownload, $preview = null, $offlin
|
|||
|
||||
$fs = get_file_storage();
|
||||
|
||||
$sendfileoptions = ['preview' => $preview, 'offline' => $offline];
|
||||
$sendfileoptions = ['preview' => $preview, 'offline' => $offline, 'embed' => $embed];
|
||||
|
||||
// ========================================================================================================================
|
||||
if ($component === 'blog') {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue