You are here

function theme_filefield_unguarded in FileField 6.2

Theme function for any file that is managed by filefield. It doesn't really format stuff by itself but rather redirects to other formatters that are telling us they want to handle the concerned file.

This function does not check if the file may be shown, it returns markup in any case (except if the file doesn't exist at all). If you need to check permissions, please use theme('filefield_guarded') instead.

1 theme call to theme_filefield_unguarded()
theme_filefield in ./filefield.formatter.inc
Theme function for any file that is managed by filefield. It doesn't really format stuff by itself but rather redirects to other formatters that are telling us they want to handle the concerned file.

File

./filefield.formatter.inc, line 52
FileField: Defines a CCK file field type.

Code

function theme_filefield_unguarded($file, $field) {
  if (empty($file['fid']) || !is_file($file['filepath'])) {
    return '';
  }
  drupal_add_css(drupal_get_path('module', 'filefield') . '/filefield.css');
  $file_formatter_info = filefield_formatter_for_file($file, $field);
  if (empty($file_formatter_info)) {
    return '<div class="filefield-item filefield-item-empty"/>';
  }
  foreach ($file_formatter_info['css'] as $css_path) {
    drupal_add_css($css_path);
  }
  $settings = isset($field['file_formatters'][$file_formatter_info['key']]) ? $field['file_formatters'][$file_formatter_info['key']] : NULL;
  return '<div class="filefield-item">' . theme($file_formatter_info['theme'], (object) $file, $field, $settings) . '</div>';
}