function media_registration_item_formatters in D7 Media 6
Return a set of formatters which can format the specified item.
If $description is NULL, all formatters will be returned. A set of registered modules can be passed in to narrow the formatter options.
Parameters
string $description: File extension to return.
array $registrations: (Optional) If specified, then match only against these registrations.
Return value
array An array of formatter ids keyed by module.
File
- ./
media.module, line 335 - Media API
Code
function media_registration_item_formatters($description = '*', $registrations = NULL) {
$formatters = array();
// Get all the registrations if we don't have any.
if (is_NULL($registrations)) {
$registrations = media_get_registered_modules();
}
// Iterate through each of the registered modules and find the formatters.
foreach ($registrations as $id => $registration) {
// Look for the formatter, or just take all (wildcard being *).
if (is_array($registration['kind']['formatter']['types']) && in_array($registration['kind']['formatter']['types'], $description) || $description == '*' || $registration['kind']['formatter']['types'] == '*') {
$formatters[$registration['module']] = $id;
}
}
return $formatters;
}