MDL-80150 resource: Reintroduce file icon

The new activity card design, planned for Moodle 4.3, reintroduces
the resource MIME icon that was removed in Moodle 4.0.
This is a backport of MDL-78285.
This commit is contained in:
Sara Arjona
2023-11-29 02:07:07 +01:00
committed by Luca Bösch
parent 253028f813
commit 43a10cb268
2 changed files with 3 additions and 0 deletions
+1
View File
@@ -227,6 +227,7 @@ function resource_get_coursemodule_info($coursemodule) {
if (count($files) >= 1) {
$mainfile = reset($files);
$resource->mainfile = $mainfile->get_filename();
$info->icon = file_file_icon($mainfile, 24);
}
$display = resource_get_final_display_type($resource);
+2
View File
@@ -144,11 +144,13 @@ class lib_test extends \advanced_testcase {
$info = resource_get_coursemodule_info(
$DB->get_record('course_modules', array('id' => $resource2->cmid)));
$this->assertEquals('R2', $info->name);
$this->assertEquals('f/text-24', $info->icon);
// For third one, it should use the highest sortorder icon.
$info = resource_get_coursemodule_info(
$DB->get_record('course_modules', array('id' => $resource3->cmid)));
$this->assertEquals('R3', $info->name);
$this->assertEquals('f/document-24', $info->icon);
}
public function test_resource_core_calendar_provide_event_action() {