1

I have a function in template.php:

function test_file_icon($variables) {
  $file = $variables['file'];
  $icon_directory = drupal_get_path('theme', 'test') . '/images/icons';

  $mime = check_plain($file->filemime);
  $icon_url = file_icon_url($file, $icon_directory);
  return '<div class="file-icon"><img alt="" class="file-icon" src="' . $icon_url . '" title="' . $mime . '" /></div>';

}

and at the end of file icon i want to show date of file create. Can anyone suggest?

1

Just add the format_date($file->timestamp) somewhere to html of the return value. To set the proper time format, see the documentation of format_date().

return '<div class="file-icon"><img alt="" class="file-icon" src="' . $icon_url . '" title="' . $mime . '" /> ' . format_date($file->timestamp) . ' </div>';

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.