function theme_soundcloudfield_formatter_default in SoundCloud field 6
Theme function for 'default' field formatter.
Implementation of theme_formatter_default.
Parameters
$element:
Return value
string
File
- ./
soundcloudfield.module, line 333 - SoundCloud CCK field.
Code
function theme_soundcloudfield_formatter_default($element) {
$output = '';
// if (!empty($element['#item']['embed'])) {
$field_info = soundcloudfield_get_content_node_field_instance_by_field_name($element['#field_name']);
if ($field_info['widget_type'] == 'soundcloud_url') {
$field_info['widget_settings'] = unserialize($field_info['widget_settings']);
$width = $field_info['widget_settings']['width'];
$color = $field_info['widget_settings']['color'];
$showcomments = $field_info['widget_settings']['showcomments'] ? 'true' : 'false';
$autoplay = $field_info['widget_settings']['autoplay'] ? 'true' : 'false';
$showplaycount = $field_info['widget_settings']['showplaycount'] ? 'true' : 'false';
$showartwork = $field_info['widget_settings']['showartwork'] ? 'true' : 'false';
$encoded_url = urlencode($element['#item']['embed']);
$parsed_url = parse_url($element['#item']['embed']);
$splitted_url = explode("/", $parsed_url['path']);
if ($splitted_url[2] != 'sets') {
$height = $field_info['widget_settings']['height'];
$params = 'url=' . $encoded_url . '&show_comments=' . $showcomments . '&auto_play=' . $autoplay . '&color=' . $color;
}
else {
$height = $field_info['widget_settings']['setheight'];
$params = 'url=' . $encoded_url . '&show_comments=' . $showcomments . '&auto_play=' . $autoplay . '&show_playcount=' . $showplaycount . '&show_artwork=' . $showartwork . '&color=' . $color;
}
$output .= '<object height="' . $height . '" width="' . $width . '%"><param name="movie" value="https://player.' . $parsed_url['host'] . '/player.swf?' . $params . '"></param>';
$output .= '<param name="allowscriptaccess" value="always"></param><embed allowscriptaccess="always" height="' . $height . '" src="http://player.' . $parsed_url['host'] . '/player.swf?' . $params . '" type="application/x-shockwave-flash" width="' . $width . '%"></embed></object>';
}
return $output;
// }
// else {
// return NULL;
// }
}