function file_displays_load in D7 Media 7
Returns an array of {file_display} objects for the file type and view mode.
3 calls to file_displays_load()
- file_displays in file_entity/
file_entity.file_api.inc - Returns an array of possible displays to use for a file type in a given view mode.
- file_entity_file_display_form in file_entity/
file_entity.admin.inc - Form callback; presents file display settings for a given view mode.
- file_entity_file_display_form_submit in file_entity/
file_entity.admin.inc - Process file display settings form submissions.
File
- file_entity/
file_entity.file_api.inc, line 334 - API extensions of Drupal core's file.inc.
Code
function file_displays_load($file_type, $view_mode, $key_by_formatter_name = FALSE) {
ctools_include('export');
$display_names = array();
$prefix = $file_type . '__' . $view_mode . '__';
foreach (array_keys(file_info_formatter_types()) as $formatter_name) {
$display_names[] = $prefix . $formatter_name;
}
$displays = ctools_export_load_object('file_display', 'names', $display_names);
if ($key_by_formatter_name) {
$prefix_length = strlen($prefix);
$rekeyed_displays = array();
foreach ($displays as $name => $display) {
$rekeyed_displays[substr($name, $prefix_length)] = $display;
}
$displays = $rekeyed_displays;
}
return $displays;
}