You are here

function theme_views_rss_formatter_enclosure_file in Views RSS 6

Generic formatter for 'filefield' CCK fields added to RSS <enclosure> element.

1 string reference to 'theme_views_rss_formatter_enclosure_file'
views_rss_theme in ./views_rss.module
Implementation of hook_theme().

File

views/views_rss_views_fields.theme.inc, line 116

Code

function theme_views_rss_formatter_enclosure_file($element) {

  // Inside a view $element may contain NULL data. In that case, just return.
  if (empty($element['#item']['fid'])) {
    return;
  }

  // Return formatted XML element.
  return strtr('<enclosure url="!url" length="!length" type="!type" />', array(
    '!url' => url($element['#item']['filepath'], array(
      'absolute' => TRUE,
    )),
    '!length' => $element['#item']['filesize'],
    '!type' => $element['#item']['filemime'],
  ));
}