MDL-71457 theme_boost: activity icon styling

This commit is contained in:
Bas Brands 2021-09-20 11:53:23 +02:00
parent 5958c0df0c
commit f2ddd23ec1
44 changed files with 319 additions and 158 deletions

View file

@ -26,7 +26,7 @@ defined('MOODLE_INTERNAL') || die;
/**
* List of features supported in Resource module
* @param string $feature FEATURE_xx constant for requested feature
* @return mixed True if module supports feature, false if not, null if doesn't know
* @return mixed True if module supports feature, false if not, null if doesn't know or string for the module purpose.
*/
function resource_supports($feature) {
switch($feature) {
@ -39,6 +39,7 @@ function resource_supports($feature) {
case FEATURE_GRADE_OUTCOMES: return false;
case FEATURE_BACKUP_MOODLE2: return true;
case FEATURE_SHOW_DESCRIPTION: return true;
case FEATURE_MOD_PURPOSE: return MOD_PURPOSE_CONTENT;
default: return null;
}
@ -217,7 +218,6 @@ function resource_get_coursemodule_info($coursemodule) {
}
if ($resource->tobemigrated) {
$info->icon ='i/invalid';
return $info;
}
@ -226,7 +226,6 @@ function resource_get_coursemodule_info($coursemodule) {
$files = $fs->get_area_files($context->id, 'mod_resource', 'content', 0, 'sortorder DESC, id ASC', false, 0, 0, 1);
if (count($files) >= 1) {
$mainfile = reset($files);
$info->icon = file_file_icon($mainfile, 24);
$resource->mainfile = $mainfile->get_filename();
}

View file

@ -143,13 +143,11 @@ class mod_resource_lib_testcase 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() {