- file_block in contributions/fileframework/file.module
- Implementation of hook_block().
_file_block_formats()Gets the file's derivatives.
A file node object.
contributions/fileframework/file.module, line 766
<?php
function _file_block_formats() {
if (arg(0) == 'node' && preg_match('/(\d+)/', arg(1), $matches)) {
$file_node = node_load($matches[1]);
if (is_object($file_node) && $file_node->type == 'file' && !empty($file_node->file)) {
$formats = array();
$file_uris = file_generated_for($file_node->file);
foreach ($file_uris as $uri => $data) {
if ($file_node->file->uri != $uri) {
$formats[] = array_merge($data, array(
'uri' => $uri,
'hash' => file_get_hash($uri),
'href' => bitcache_resolve_uri($uri, array('absolute' => TRUE)),
'description' => file_mime_description_for($data['type']),
));
}
}
return theme('file_block_formats', array('formats' => $formats, 'nid' => $file_node->nid, 'vid' => $file_node->vid));
}
}
}
?>