I have a file field in a node and I would like all instances of this field to have a different display name.

I use the file field to upload images that users can download - e.g. flower.jpg, horse.jpg.

Instead of the field displaying " flower.jpg",I want it do display the text "download".

The machine name of my field is "field_source" and the name of my theme is " kickstart". The content type is " resource".

What would a pre-process function in my template.php look like to do this?

This is as far as i get:

function kickstart_preprocess_node(&$vars){
  if($vars['type'] == 'resources'){
    $vars['content']['field-source']['#title'] = 'download';


2 Answers 2


if you only want to change the label maybe the module string overrides is your best option https://www.drupal.org/project/stringoverrides

you can also edit your settings.php file to change the label https://www.drupal.org/node/522036


The easiest programmatic way to do this is to override the field template file for your specific field.

  1. Create a file named field--field-source.tpl.php (assuming that the machine name of your field is field_source).
  2. Copy and paste the code for the default Drupal field template file (which is called field.tpl.php, and is very well documented in terms of the variables it receives). Customize it to your needs.

Use the dpm() function (enable Devel) to troubleshoot the variables that the new template file receives.

Information about Drupal's template files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.