1 views_handler_field_file_rendered.inc | views_handler_field_file_rendered::options_form(&$form, &$form_state) |
Provide file_view_mode option for file display.
Overrides views_handler_field::options_form
File
- core/
modules/ file/ views/ views_handler_field_file_rendered.inc, line 22 - Definition of views_handler_field_file_rendered.
Class
- views_handler_field_file_rendered
- Field handler to render a file with a view mode using file_view_file().
Code
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
$entity_info = entity_get_info('file');
$options = array('default' => t('Default'));
foreach ($entity_info['view modes'] as $file_view_mode => $file_view_mode_info) {
$options[$file_view_mode] = $file_view_mode_info['label'];
}
$form['file_view_mode'] = array(
'#title' => t('File view mode'),
'#description' => t('Select a view mode. Note that only the file will be rendered and not any of its fields.'),
'#type' => 'select',
'#default_value' => $this->options['file_view_mode'],
'#options' => $options,
);
}