Drupal - Render a field contained inside of another field

I think the issue here is that each of those paragraph groupings contain various elements that are array keys. For example, if you dpm up to $content['field_paragraph'], you may see values that look like this:

enter image description here

I think the issue is, due to your loops, your trying to render/loop through things that aren't objects. To get around this, you might want to try checkin if the key is numeric before proceeding on.

Something along the lines like this:

<?php
    foreach($content['field_paragraph'] as $key=>$array){
  if (is_int($key)) {
    foreach ( $array['entity']['paragraphs_item'] as $key2=>$item ) {
    if ( is_int($key2) ) {
      print render($item['field_body']);
    }
  }
  }
}

?>

Note the is_int($key), that's what you need to get the errors to go away. Note my code has my own field names in it, so you'll just need to switch yours in.


Instead of overriding and creating templates, manage all of the display of the entity through the UI and create field formatters for field types when core doesn't cover your display requirements.

This is a much cleaner way of defining displays, templates get messy fast especially when diving into references.