If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Core filetypes

From MoodleDocs
Revision as of 14:19, 3 May 2024 by Sara Arjona Téllez (talk | contribs) (This page will not be migrated to new devdocs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Warning: This page is no longer in use. The information contained on the page should NOT be seen as relevant or reliable.

lib/classes/filetypes.php defines the filetypes included in core.

get_default_types returns an associative array of extension keys to a value which is an array of type, icon, groups and string (which is a lang string which will be used when displaying the type. The lang string is passed $a->EXT which is the actual extension.

'php' => array('type' => 'text/plain', 'icon' => 'sourcecode'),                                                                                                                                                                                                                                                                                           
'pic' => array('type' => 'image/pict', 'icon' => 'image', 'groups' => array('image'), 'string' => 'image'),                                                                                                                                                                                                                                               
'pict' => array('type' => 'image/pict', 'icon' => 'image', 'groups' => array('image'), 'string' => 'image'),                                                                                                                                                                                                                                              
'png' => array('type' => 'image/png', 'icon' => 'png', 'groups' => array('image', 'web_image'), 'string' => 'image')

String example (in lang/en/mimetypes.php)

$string['image'] = 'Image ({$a->MIMETYPE2})';

Any groups added should add a language string to lang/en/mimetypes.php with the formate group:<groupname>. This is so that the group can be displayed in a human readable formate in the user's native language.