1 file.field.inc | file_field_formatter_settings_summary($field, $instance, $view_mode) |
Implements hook_field_formatter_settings_summary().
File
- core/
modules/ file/ file.field.inc, line 542 - Field module functionality for the File module.
Code
function file_field_formatter_settings_summary($field, $instance, $view_mode) {
$display = $instance['display'][$view_mode];
$settings = $display['settings'];
$summary = array();
if ($display['type'] === 'file_rendered') {
$view_mode_label = file_view_mode_label($settings['file_view_mode'], t('Unknown'));
$summary[] = t('View mode: %mode', array('%mode' => $view_mode_label));
}
elseif ($display['type'] == 'file_download_link') {
$summary[] = t('Link text: %text', array('%text' => $settings['text']));
}
elseif ($display['type'] === 'file_audio') {
if (isset($settings['controls'])) {
$summary[] = t('Controls: %controls', array('%controls' => $settings['controls'] ? 'visible' : 'hidden'));
}
if (isset($settings['autoplay'])) {
$summary[] = t('Autoplay: %autoplay', array('%autoplay' => $settings['autoplay'] ? t('yes') : t('no')));
}
if (isset($settings['loop'])) {
$summary[] = t('Loop: %loop', array('%loop' => $settings['loop'] ? t('yes') : t('no')));
}
if (!empty($settings['preload'])) {
$summary[] = t('Preload: %preload', array('%preload' => $settings['preload']));
}
if (isset($settings['multiple_file_behavior'])) {
$summary[] = t('Multiple files: %multiple', array('%multiple' => $settings['multiple_file_behavior']));
}
}
elseif ($display['type'] === 'file_video') {
if (isset($settings['controls'])) {
$summary[] = t('Controls: %controls', array('%controls' => $settings['controls'] ? 'visible' : 'hidden'));
}
if (isset($settings['autoplay'])) {
$summary[] = t('Autoplay: %autoplay', array('%autoplay' => $settings['autoplay'] ? t('yes') : t('no')));
}
if (isset($settings['loop'])) {
$summary[] = t('Loop: %loop', array('%loop' => $settings['loop'] ? t('yes') : t('no')));
}
if (isset($settings['muted'])) {
$summary[] = t('Muted: %muted', array('%muted' => $settings['muted'] ? t('yes') : t('no')));
}
if ($settings['width'] && $settings['height']) {
$summary[] = t('Size: %width x %height', array('%width' => $settings['width'], '%height' => $settings['height']));
}
if (!empty($settings['preload'])) {
$summary[] = t('Preload: %preload', array('%preload' => $settings['preload']));
}
if (isset($settings['multiple_file_behavior'])) {
$summary[] = t('Multiple files: %multiple', array('%multiple' => $settings['multiple_file_behavior']));
}
}
return implode('<br />', $summary);
}