By pcfeeler@gmail.com on
by default "table of files" displays format in cck file field display two columns>
1. file name
2. file siz
i wanna show description field for each file in a column next to file size column.
file.field.inc in file module has something like this:
function theme_file_formatter_table($variables) {
$header = array(t('Attachment'), t('Size'),t('<strong>my needed desc field</strong>');
$rows = array();
foreach ($variables['items'] as $delta => $item) {
$rows[] = array(
theme('file_link', array('file' => (object) $item)),
format_size($item['filesize'])
);
}
return empty($rows) ? '' : theme('table', array('header' => $header, 'rows' => $rows));
}i added 'my needed desc field' to above code(in $header) but i don`t know how to show description field of each file in $rows. is there anyway to do that?
Comments
RE: overviding file module >"table of files" display format
In your theme put the function MYTHEME_file_formatter_table
in your template.php to override . Instead of MYTHEME you will put the name of your theme.
Here's an example which adds upload date.
Hello, I have succesfully
Hello,
I have succesfully added the timestamp as described above but heaving problems adding a description.
Can you please tell me what info and where should I look for to insert?
I have looked file types under structure/file type/document/manage fields and have found what I previously added file description with the machine name: field_leiras.
I added this to the file.field.inc under format_date but when I refresh nothing shows.
Where should I look for the name the I need to enter to get the description in table of files?
thx
TWEAK FILE ATTACHMENT TABLE WITH TITLE, FILESIZE & DATE
When I set up content types with file attachments I usually select "allow title". By default, if no title is entered the filename is used by default. So, below are just a couple of items I've used to make some small tweaks to the output. You can further tweak each item with CSS; for example, setting "file table" text to 10px and after that rule setting a rule for file-table LINKS to be 11px or whatever. Works like a charm.
~enjoy or loss of nothing :)
From These Ruins - Temptation