class Mimetypes in File Entity (fieldable files) 8.2
Overrides a MIME type guesser to provide a public list of MIME types.
@todo remove if https://www.drupal.org/node/1921558#comment-9007545 agree on a fix.
Hierarchy
- class \Drupal\Core\File\MimeType\ExtensionMimeTypeGuesser implements \Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesserInterface
- class \Drupal\file_entity\Mimetypes
Expanded class hierarchy of Mimetypes
1 file declares its use of Mimetypes
- FileTypeForm.php in src/
Form/ FileTypeForm.php
File
- src/
Mimetypes.php, line 12
Namespace
Drupal\file_entityView source
class Mimetypes extends ExtensionMimeTypeGuesser {
/**
* Get MIME types.
*
* @return array
* An associative array of MIME types, keyed by extensions.
*/
public function get() {
if ($this->mapping === NULL) {
$mapping = $this->defaultMapping;
// Allow modules to alter the default mapping.
$this->moduleHandler
->alter('file_mimetype_mapping', $mapping);
$this->mapping = $mapping;
}
return $this->mapping['mimetypes'];
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ExtensionMimeTypeGuesser:: |
protected | property | Default MIME extension mapping. | |
ExtensionMimeTypeGuesser:: |
protected | property | The MIME types mapping array after going through the module handler. | |
ExtensionMimeTypeGuesser:: |
protected | property | The module handler. | |
ExtensionMimeTypeGuesser:: |
public | function | Guesses the mime type of the file with the given path. | |
ExtensionMimeTypeGuesser:: |
public | function | Sets the mimetypes/extension mapping to use when guessing mimetype. | |
ExtensionMimeTypeGuesser:: |
public | function | Constructs a new ExtensionMimeTypeGuesser. | |
Mimetypes:: |
public | function | Get MIME types. |