i am developing a new resource type and i have recognized nearly immediately that the resource type name can be set only in the resource.php. Is that right?
I found the resource_get_types() function in the resources lib.php which seems to get the localized string only from the resource.php. Is there a possibility to add the string at runtime?
Because this is not a very modular behaviour and it would make me happy if i have not to modify a standard moodle file for my module.
Greetings
Adam
function resource_get_types() {
global $CFG; $types = array(); $standardresources = array('text','html','file','directory'); foreach ($standardresources as $resourcetype) { $type = new object(); $type->modclass = MOD_CLASS_RESOURCE; $type->type = "resource&type=$resourcetype"; $type->typestr = get_string("resourcetype$resourcetype", 'resource'); $types[] = $type; }
/// Drop-in extra resource types
$resourcetypes = get_list_of_plugins('mod/resource/type'); foreach ($resourcetypes as $resourcetype) { if (!empty($CFG->{'resource_hide_'.$resourcetype})) { // Not wanted continue; }
if (!in_array($resourcetype, $standardresources)) { $type = new object(); $type->modclass = MOD_CLASS_RESOURCE; $type->type = "resource&type=$resourcetype"; $type->typestr = get_string("resourcetype$resourcetype", 'resource'); $types[] = $type; }
} return $types;
}