I have a piece of code to display some fields of a node like this using view mode 'full':

  $fields = field_attach_view('node', $node, 'full');
  $content .= drupal_render($fields);

The odd thing is that the entityreference field doesn't show up although it's enabled in the 'full' view mode.
If I insert something like this it displays though:

  field_view_field('node', $node, 'field_reference', 'full');

So my guess is that field_view_field includes some file that field_attach_view misses. But since this only happens with entityreference fields I wonder what file that could be?

Comments

tyler.frankenstein’s picture

FWIW, the following snippet can be used to programmatically render the "Rendered entity" format and hide the label:

  field_view_field(
    'node',
    $node,
    'field_reference',
    array(
      'label' => 'hidden',
      'type' => 'entityreference_entity_view'
    )
  );