function MimeTypeMap::getMimeTypeForExtension
Same name and namespace in other branches
- main core/lib/Drupal/Core/File/MimeType/MimeTypeMap.php \Drupal\Core\File\MimeType\MimeTypeMap::getMimeTypeForExtension()
File
-
core/
lib/ Drupal/ Core/ File/ MimeType/ MimeTypeMap.php, line 966
Class
- MimeTypeMap
- Provides a sensible mapping between filename extensions and MIME types.
Namespace
Drupal\Core\File\MimeTypeCode
public function getMimeTypeForExtension($extension) : ?string {
$extension = strtolower($extension);
$extensions = $this->mapping['extensions'] ?? [];
return isset($extensions[$extension]) ? $this->mapping['mimetypes'][$extensions[$extension]] : NULL;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.