Commit d29adc88 authored by alexpott's avatar alexpott

Issue #2297947 by amitgoyal, andrewmacpherson: Clean up API docs for...

Issue #2297947 by amitgoyal, andrewmacpherson: Clean up API docs for hook_file_mimetype_mapping_alter().
parent dc7a5422
......@@ -1297,16 +1297,19 @@ function file_upload_max_size() {
* @param $mapping
* An optional map of extensions to their mimetypes, in the form:
* - 'mimetypes': a list of mimetypes, keyed by an identifier,
* - 'extensions': the mapping itself, an associative array in which
* the key is the extension (lowercase) and the value is the mimetype
* identifier. If $mapping is NULL file_mimetype_mapping() is called.
* - 'extensions': the mapping itself, an associative array in which the key
* is the extension (lowercase) and the value is the mimetype identifier.
*
* @return
* The internet media type registered for the extension or
* application/octet-stream for unknown extensions.
*
* @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0.
* Use \Drupal::service('file.mime_type.guesser')->guess($uri).
* @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0. Calls are
* passed on to a new file.mime_type.guesser service, and the $mapping
* parameter is ignored. Use
* \Drupal::service('file.mime_type.guesser')->guess($uri).
*
* @see \Drupal\Core\File\MimeType\ExtensionMimeTypeGuesser::guess()
*/
function file_get_mimetype($uri, $mapping = NULL) {
return \Drupal::service('file.mime_type.guesser')->guess($uri);
......
......@@ -2304,16 +2304,17 @@ function hook_install_tasks_alter(&$tasks, $install_state) {
/**
* 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().
* Invoked by \Drupal\Core\File\MimeType\ExtensionMimeTypeGuesser::guess(). It
* is used to allow modules to add to or modify the default mapping from
* \Drupal\Core\File\MimeType\ExtensionMimeTypeGuesser::$defaultMapping.
*
* @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()
* @see \Drupal\Core\File\MimeType\ExtensionMimeTypeGuesser::guess()
* @see \Drupal\Core\File\MimeType\ExtensionMimeTypeGuesser::$defaultMapping
*/
function hook_file_mimetype_mapping_alter(&$mapping) {
// Add new MIME type 'drupal/info'.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment