function audiofield_field_formatter_settings_summary in AudioField 7
Implements hook_field_formatter_settings_summary().
File
- ./
audio.field.inc, line 222 - Implement an audio field, based on the file module's file field.
Code
function audiofield_field_formatter_settings_summary($field, $instance, $view_mode) {
$display = $instance['display'][$view_mode];
$settings = $display['settings'];
if ($display['type'] == 'audiofield_player') {
// Get the players.
$players = audiofield_players();
// Build the summary.
$summary = array();
// Loop over each available filetype for the field and show the player.
$accepted_filetypes = $instance['settings']['file_extensions'];
foreach (preg_split('/\\s+/', $accepted_filetypes) as $filetype) {
$summary[] = array(
'#type' => 'item',
'#title' => t('Selected audio player (@filetype)', array(
'@filetype' => $filetype,
)),
'#markup' => $players[$settings['audiofield_audioplayer_' . $filetype]]['name'],
);
}
// Additional settings.
$summary[] = array(
'#type' => 'item',
'#title' => t('Display Download Link'),
'#markup' => $settings['download_link'] == 1 ? t('Yes') : t('No'),
);
$summary[] = array(
'#type' => 'item',
'#title' => t('Display File Details'),
'#markup' => $settings['display_file_details'] == 1 ? t('Yes') : t('No'),
);
}
return drupal_render($summary);
}