mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-76555 mod_resource: Fix PHP8.0 type error (legacy resources)
This commit is contained in:
parent
e4d1369475
commit
44d2db0de1
@ -29,7 +29,10 @@ class activitybadge extends \core_courseformat\output\activitybadge {
|
||||
* This method will be called before exporting the template.
|
||||
*/
|
||||
protected function update_content(): void {
|
||||
$options = (object) ['displayoptions' => $this->cminfo->customdata['displayoptions']];
|
||||
$this->content = resource_get_optional_filetype($options, $this->cminfo);
|
||||
$customdata = $this->cminfo->customdata;
|
||||
if (is_array($customdata) && isset($customdata['displayoptions'])) {
|
||||
$options = (object) ['displayoptions' => $customdata['displayoptions']];
|
||||
$this->content = resource_get_optional_filetype($options, $this->cminfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -271,12 +271,13 @@ function resource_get_coursemodule_info($coursemodule) {
|
||||
function resource_cm_info_view(cm_info $cm) {
|
||||
global $CFG;
|
||||
require_once($CFG->dirroot . '/mod/resource/locallib.php');
|
||||
|
||||
$resource = (object) ['displayoptions' => $cm->customdata['displayoptions']];
|
||||
$details = resource_get_optional_details($resource, $cm, false);
|
||||
if ($details) {
|
||||
$cm->set_after_link(' ' . html_writer::tag('span', $details,
|
||||
array('class' => 'resourcelinkdetails')));
|
||||
$customdata = $cm->customdata;
|
||||
if (is_array($customdata) && isset($customdata['displayoptions'])) {
|
||||
$resource = (object) ['displayoptions' => $customdata['displayoptions']];
|
||||
$details = resource_get_optional_details($resource, $cm, false);
|
||||
if ($details) {
|
||||
$cm->set_after_link(' ' . html_writer::tag('span', $details, ['class' => 'resourcelinkdetails']));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user