summaryrefslogtreecommitdiff
path: root/modules/system/system.api.php
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-08-31 05:47:34 +0000
committerDries Buytaert <dries@buytaert.net>2009-08-31 05:47:34 +0000
commit41dca3c4e0ec3d355977735f74af2e49ea0eedd7 (patch)
treebd4ac8b82e19e018b3a0c8d12f11d2541fa8488f /modules/system/system.api.php
parent26a5f0408b8db92f85af90695269cc69c67e41bf (diff)
downloadbrdo-41dca3c4e0ec3d355977735f74af2e49ea0eedd7.tar.gz
brdo-41dca3c4e0ec3d355977735f74af2e49ea0eedd7.tar.bz2
- Patch #331171 by pwolanin, mfb, drewish: allow modules to alter the MIME extension mapping rather than setting a huge variable.
Diffstat (limited to 'modules/system/system.api.php')
-rw-r--r--modules/system/system.api.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/modules/system/system.api.php b/modules/system/system.api.php
index 5f50c30d2..6ec40db01 100644
--- a/modules/system/system.api.php
+++ b/modules/system/system.api.php
@@ -2160,5 +2160,27 @@ function hook_profile_tasks() {
}
/**
+ * Alter MIME type mappings used to determine MIME type from a file extension.
+ *
+ * This hook is run when file_mimetype_mapping() is called. It is used to
+ * allow modules to add to or modify the default mapping from
+ * file_default_mimetype_mapping().
+ *
+ * @param $mapping
+ * An array of mimetypes correlated to the extensions that relate to them.
+ * The array has 'mimetypes' and 'extensions' elements, each of which is an
+ * array.
+ * @see file_default_mimetype_mapping()
+ */
+function hook_file_mimetype_mapping_alter(&$mapping) {
+ // Add new MIME type 'drupal/info'.
+ $mapping['mimetypes']['example_info'] = 'drupal/info';
+ // Add new extension '.info' and map it to the 'drupal/info' MIME type.
+ $mapping['extensions']['info'] = 'example_info';
+ // Override existing extension mapping for '.ogg' files.
+ $mapping['extensions']['ogg'] = 189;
+}
+
+/**
* @} End of "addtogroup hooks".
*/