_file_block_formats

Versions
6
_file_block_formats()

Gets the file's derivatives.

Return value

A file node object.

Code

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));
    }
  }
}
?>

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters (without spaces) shown in the image.