function media_get_applicable_formatters in D7 Media 6
Select registrations for use by matching against uri and file extension.
Parameters
array $registrations: Array of extensions.
string $uri: The kind of uri being used.
string $file_extension: The current file extension.
Return value
array An array of applicable formatters.
File
- ./
media.module, line 272 - Media API
Code
function media_get_applicable_formatters($registrations, $file_extension) {
// Do we have a file extension?
if ($file_extension) {
foreach ($registrations as $id => $formatter) {
// Does this formatter use any file type? If not, then we have to dig.
if (!$formatter['types'] == MEDIA_TYPES_DEFAULT) {
// We need to see if this file type is supported specifically.
if (!in_array($file_extension, $registration['types'])) {
// This registration is not useful.
unset($registrations[$id]);
}
}
}
}
return $registrations;
}