public function MimetypeService::extensionToMimetype in Search File Attachments 8
Convert a file extension to the corresponding mimetype.
Parameters
string $extension: A file extension.
Return value
null|string The corresponding mimetype or null if no mimetype for the extension was found.
1 call to MimetypeService::extensionToMimetype()
- MimetypeService::extensionsToMimetypes in src/
MimetypeService.php - Convert file extensions to the corresponding mimetype.
File
- src/
MimetypeService.php, line 163
Class
- MimetypeService
- Service that handles the mimetypes of file extensions.
Namespace
Drupal\search_file_attachmentsCode
public function extensionToMimetype($extension) {
if ($mimetype = $this
->fromExtension($extension)) {
return $mimetype;
}
elseif (in_array($extension, $this
->getMimetypes())) {
return $mimetype;
}
}