You are here

public function MimetypeService::fromExtension in Search File Attachments 8

Maps a file extension to a mimetype.

Parameters

string $extension: The file extension.

Return value

string|null The mimetype.

See also

mimetype_from_extension()

1 call to MimetypeService::fromExtension()
MimetypeService::extensionToMimetype in src/MimetypeService.php
Convert a file extension to the corresponding mimetype.

File

src/MimetypeService.php, line 183

Class

MimetypeService
Service that handles the mimetypes of file extensions.

Namespace

Drupal\search_file_attachments

Code

public function fromExtension($extension) {
  $extension = strtolower($extension);
  return isset($this->mimetypes[$extension]) ? $this->mimetypes[$extension] : NULL;
}