I know this is not the typical support request but I am at wit's end trying to have figured this out for several days now. I have scoured the web and any posts or documentation on drupal.org but still come up empty. I am simply trying to create a variable for the FID for a field collection filefield item. Typically I do this with field_get_items as a node preprocess function in template.php and then render the variable in my node template.

My typical code using field_get_items is:

function MYTHEME_preprocess_node(&$vars, $hook) {
$node = $vars['node'];
// Load data from 'field_event_file'.
$event_file_items = field_get_items('node', $node, 'field_event_file');
// Load individual data from 'field_event_file'.
$vars['file_id'] = $event_file_items[0]['fid'];
}

... and then in my custom node.tpl.php, I use:

<?php print $file_id; ?>

... to render the File ID.


I realize that this is different with Field Collections items. I had a look at this issue and am using a custom field collection template (field-collection-item--field_video_collection.tpl.php in my case) which works fine to render the basic field collection fields so that I can theme them, i.e. <?php print render($content['field_video_file_col']); ?>

My field collection is called: field_video_collection
The field collection item that I am trying to extract the FID and print out is called field_video_file_col

and when I print variables in field-collection-item--field_video_collection.tpl.php, I see:

["field_video_file_col"]=>
          array(1) {
            ["und"]=>
            array(1) {
              [0]=>
              array(12) {
                ["fid"]=>
                string(3) "888"

... so I know the data is there for the taking, I just cannot figure out the taking so to speak.

I had a look at the posts below which seem relevant and adapted the code to my use case in different incarnations but still no joy.

How to Extract Label of a Field, which is inside FieldCollection?
Understanding Field Collection Values

I also have my own issue open on Stack Exchange but nothing has helped me there either.