View source
<?php
namespace Drupal\imagemagick;
use Drupal\Core\File\MimeType\ExtensionMimeTypeGuesser;
class Todo2311679 extends ExtensionMimeTypeGuesser {
public function getExtensionsForMimeType($mimetype) {
if ($this->mapping === NULL) {
$mapping = $this->defaultMapping;
$this->moduleHandler
->alter('file_mimetype_mapping', $mapping);
$this->mapping = $mapping;
}
if (!in_array($mimetype, $this->mapping['mimetypes'])) {
return [];
}
$key = array_search($mimetype, $this->mapping['mimetypes']);
$extensions = array_keys($this->mapping['extensions'], $key, TRUE);
sort($extensions);
return $extensions;
}
public function getMimeTypes() {
if ($this->mapping === NULL) {
$mapping = $this->defaultMapping;
$this->moduleHandler
->alter('file_mimetype_mapping', $mapping);
$this->mapping = $mapping;
}
return array_values($this->mapping['mimetypes']);
}
}