fileupload_view
developer/examples/fileupload.module, строка 99
- Версии
- 5
fileupload_view(&$node, $teaser = FALSE, $page = FALSE)
Implementation of hook_view.
Код
<?php
function fileupload_view(&$node, $teaser = FALSE, $page = FALSE) {
$node = node_prepare($node, $teaser);
if ($file = $node->file) {
// Only create link to file when it is in the proper location.
if ($file->filesize && file_check_location($file->filepath, file_directory_path())) {
$node->content['body']['#value'] = l($file->filename, file_create_url($file->filepath));
}
else {
$node->content['body']['#value'] = $file->filename;
}
// display the file's size
$node->content['body']['#value'] .= ' ('. format_size($file->filesize) .')';
}
return $node;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии