filefield

Drupal - overriding filefield theming

Drupal's default 'Generic File' format can be a bit ugly. Luckily, it's not too hard to override. If you'd like to change the default filefield theming for 'Generic File', try using the theme_filefield_item() function in your template.php file.

Note: You may also be interested in checking out my post on customizing the filefield format in views.

In the example below, I overrode the default theming for all cck fieldfields belonging to node type 'publication'.

Customizing the filefield format in views

Often times, you may want to customize the appearance of a views field, or perhaps add a bit of logic to the output. You can customize the display of any field in Views by utilizing the Views Customfield module.

Here's an example of how to breakdown a basic cck fieldfield into its constituent parts.

<?php
//print var_export($data, TRUE);  //prints out all available fields in view

$value = $data->node_data_field_document_field_document_fid; //relevant fid

Subscribe to RSS - filefield