function file_styles_entity_info_alter in Styles 7.2
Implements hook_entity_info_alter().
Add view modes to the file entity type, appropriate for displaying media.
File
- contrib/
file_styles/ file_styles.module, line 198 - styles/contrib/file_styles/file_styles.module File widget formatter definitions.
Code
function file_styles_entity_info_alter(&$entity_info) {
if (module_exists('file_entity')) {
$styles = styles_default_styles('file');
foreach ($styles['styles'] as $style_name => $style) {
if (!isset($entity_info['file']['view modes']['media_' . $style_name])) {
$label = isset($style['label']) ? $style['label'] : ucfirst($style_name);
$view_mode = 'file_styles_' . $style_name;
$entity_info['file']['view modes'][$view_mode] = array(
'label' => t($label),
'custom settings' => TRUE,
);
foreach ($entity_info['file']['bundles'] as $file_type => $bundle_info) {
file_styles_display_info_defaults($file_type, $view_mode, $style_name);
}
}
}
}
}