public function FileProcessorTrait::alterMime in Backup and Migrate 5.0.x
Provide the file mime for the given file extension if known.
Parameters
string $filemime: The best guess so far for the file's mime type.
array $params: A list of parameters where 'ext' is the file extension we are testing.
Return value
string The mime type of the file (or the passed in mime type if unknown)
File
- src/
Core/ Plugin/ FileProcessorTrait.php, line 51
Class
- FileProcessorTrait
- Implement the injection functionality of a file processor.
Namespace
Drupal\backup_migrate\Core\PluginCode
public function alterMime($filemime, array $params) {
// Check all of the provided file types for the given extension.
if (method_exists($this, 'getFileTypes')) {
$file_types = $this
->getFileTypes();
foreach ($file_types as $info) {
if (isset($info['extension']) && $info['extension'] == $params['ext'] && isset($info['filemime'])) {
return $info['filemime'];
}
}
}
return $filemime;
}