title: How to access items in a field collection (Drupal 7)
body: <p>I am trying to access image uri's in an array within a field collection but I don't know how to access them. If I look in the devel module, I can see the location of the first image uri in the array looks like this:</p>
  
  <pre><code>['field_text_and_image'][0]['entity']['field_collection_item'][2474]['field_about_accreditation_image'][0]['#item']['uri']
  </code></pre>
  
  <p>I am puzzled because I have 'field_get_items' method to access the field collection I am targeting like so...</p>
  
  <pre><code>$text_and_image_field = field_get_items('node', $node, 'field_text_and_image');
  </code></pre>
  
  <p>... and if I print/render this variable, I would expect to see an array printed on the page but instead nothing gets created. However, I made a condition on the page that checks to see if the '$text_and_image_field' field collection exists, and if it does to create an element, and it does indeed create an element which shows that the field exists. I just can't seem to access any of it's content. </p>
  
  <p>So, why isn't the field collection printing anything and how can I loop through the 'field_about_accreditation' array to print out all of the image uri's?</p>
  
  <p>EDIT*</p>
  
  <p>I've taken a few more stabs at the problem and realized that I made the mistake of trying to render the value of the '$text_and_image_field' when I should have been using print_r, which now doing so gives me this array value:</p>
  
  <pre><code>Array ( [0] =&gt; Array ( [value] =&gt; 2474 [revision_id] =&gt; 174439 ) )
  </code></pre>
  
  <p>Based on older code where field collections are accessed, what has happened every other time a value has been assigned to a field collection is to write the following statements:</p>
  
  <pre><code>$value = field_view_value('node', $node, '$field_text_and_image', $text_and_image_field[$i]);
  $field_collection = $value['entity']['field_collection_item'][key($value['entity']['field_collection_item'])];
  </code></pre>
  
  <p>However, when I try to print out $value (which I expect would be '2474') nothing is displayed. </p>