'; } if (filefield_file_listed($file, $field)) { return theme('filefield_file', $file); } return ''; } /** * Return whether a file should be listed when viewing the node. * * @param $file * A populated FileField item. * @param $field * A CCK field instance array. */ function filefield_file_listed($file, $field) { if ($field['list_field']) { return (bool)$file['list']; } return TRUE; } /** * Theme function for the 'generic' single file formatter. */ function theme_filefield_file($file) { // Views may call this function with a NULL value, return an empty string. if (empty($file['fid'])) { return ''; } $path = $file['filepath']; $url = file_create_url($path); $icon = theme('filefield_icon', $file); // Set options as per anchor format described at // http://microformats.org/wiki/file-format-examples // TODO: Possibly move to until I move to the more complex format described // at http://darrelopry.com/story/microformats-and-media-rfc-if-you-js-or-css $options = array( 'attributes' => array( 'type' => $file['filemime'], 'length' => $file['filesize'], ), ); // Use the description as the link text if available. if (empty($file['data']['description'])) { $link_text = $file['filename']; } else { $link_text = $file['data']['description']; $options['attributes']['title'] = $file['filename']; } return '
'. $icon . l($link_text, $url, $options) .'
'; }