Fixed exception being thrown when deleted image is selected
This commit is contained in:
parent
762e56b680
commit
309815eb7c
1 changed files with 9 additions and 8 deletions
|
@ -151,14 +151,15 @@ class element extends \mod_customcert\element {
|
||||||
if (!empty($data->fileid)) {
|
if (!empty($data->fileid)) {
|
||||||
// Array of data we will be storing in the database.
|
// Array of data we will be storing in the database.
|
||||||
$fs = get_file_storage();
|
$fs = get_file_storage();
|
||||||
$file = $fs->get_file_by_id($data->fileid);
|
if ($file = $fs->get_file_by_id($data->fileid)) {
|
||||||
$arrtostore += [
|
$arrtostore += [
|
||||||
'contextid' => $file->get_contextid(),
|
'contextid' => $file->get_contextid(),
|
||||||
'filearea' => $file->get_filearea(),
|
'filearea' => $file->get_filearea(),
|
||||||
'itemid' => $file->get_itemid(),
|
'itemid' => $file->get_itemid(),
|
||||||
'filepath' => $file->get_filepath(),
|
'filepath' => $file->get_filepath(),
|
||||||
'filename' => $file->get_filename(),
|
'filename' => $file->get_filename(),
|
||||||
];
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return json_encode($arrtostore);
|
return json_encode($arrtostore);
|
||||||
|
|
Loading…
Reference in a new issue